diff --git a/hshetl/extractors.py b/hshetl/extractors.py index bffc6e5fc0ad2246ee252789b5f8762b7272b5e6..ff16b4fa8c0d069a8ab78cc3c10884523c49c55c 100644 --- a/hshetl/extractors.py +++ b/hshetl/extractors.py @@ -124,12 +124,12 @@ class SqlAlchemyExtractor(AbstractExtractor): def _resolve_sql_query(self, query): '''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): return query['sql'] 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'] - 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