From 3fdb969f0b2e50725df4f5a62953e1ec7bfef3e9 Mon Sep 17 00:00:00 2001 From: Dennis Ahrens <dennis.ahrens@hs-hannover.de> Date: Wed, 19 Mar 2014 13:46:45 +0100 Subject: [PATCH] [BUGFIX] Accept unicode encoded queries. in the SqlAlchemyExtractor. --- hshetl/extractors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hshetl/extractors.py b/hshetl/extractors.py index bffc6e5..ff16b4f 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 -- GitLab