Skip to content
Snippets Groups Projects
Commit 3fdb969f authored by Dennis Ahrens's avatar Dennis Ahrens
Browse files

[BUGFIX] Accept unicode encoded queries.

in the SqlAlchemyExtractor.
parent 89752c6c
No related branches found
No related tags found
No related merge requests found
...@@ -124,12 +124,12 @@ class SqlAlchemyExtractor(AbstractExtractor): ...@@ -124,12 +124,12 @@ class SqlAlchemyExtractor(AbstractExtractor):
def _resolve_sql_query(self, query): def _resolve_sql_query(self, query):
'''Resolves the sql string from the query argument.''' '''Resolves the sql string from the query argument.'''
if isinstance(query, str): return query if isinstance(query, str) or isinstance(query, unicode): return query
if isinstance(query, dict) and 'sql' in query and isinstance(query['sql'], str): if isinstance(query, dict) and 'sql' in query and isinstance(query['sql'], str):
return query['sql'] return query['sql']
if isinstance(query, dict) and 'select' in query and 'from' in query and 'where' in query: if isinstance(query, dict) and 'select' in query and 'from' in query and 'where' in query:
return 'SELECT ' + query['select'] + ' FROM ' + query['from'] + ' WHERE ' + query['where'] return 'SELECT ' + query['select'] + ' FROM ' + query['from'] + ' WHERE ' + query['where']
raise ConfigurationException('The query must be a string or a dictionary containing an key sql that has a string value or a dict containing the keys select, from and where') raise ConfigurationException('The query must be a string or a dictionary containing an key sql that has a string value or a dict containing the keys select, from and where. Encountered {}'.format(type(query)))
@yamlify @yamlify
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment