From 2d32708d3442452d82c1fae5c5ed1038f5a2fe1c Mon Sep 17 00:00:00 2001 From: Vince Welke Date: Mon, 2 Mar 2020 18:28:50 -0800 Subject: [PATCH 1/2] fix syntax to be compatible with python 3.5 --- pyhive/sqlalchemy_presto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhive/sqlalchemy_presto.py b/pyhive/sqlalchemy_presto.py index aea652fb..e4218150 100644 --- a/pyhive/sqlalchemy_presto.py +++ b/pyhive/sqlalchemy_presto.py @@ -77,7 +77,7 @@ def __add_catalog(self, sql: str, table: FromClause) -> str: return sql catalog = table.dialect_options["presto"]._non_defaults["catalog"] - sql = f"\"{catalog}\".{sql}" + sql = "\"{catalog}\".{sql}".format(catalog=catalog, sql=sql) return sql From c77de4eeffd203d754fdca09f036b04b37e7cebd Mon Sep 17 00:00:00 2001 From: Vince Welke Date: Mon, 2 Mar 2020 19:12:29 -0800 Subject: [PATCH 2/2] old python 2.7 syntax update --- pyhive/presto.py | 2 +- pyhive/sqlalchemy_presto.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyhive/presto.py b/pyhive/presto.py index 18994962..4ee8489d 100644 --- a/pyhive/presto.py +++ b/pyhive/presto.py @@ -41,7 +41,7 @@ def escape_item(self, item): elif isinstance(item, datetime.date): return self.escape_date(item) else: - return super().escape_item(item) + return super(PrestoParamEscaper, self).escape_item(item) def escape_date(self, item): return "date '{}'".format(item) diff --git a/pyhive/sqlalchemy_presto.py b/pyhive/sqlalchemy_presto.py index e4218150..95ec4814 100644 --- a/pyhive/sqlalchemy_presto.py +++ b/pyhive/sqlalchemy_presto.py @@ -63,7 +63,7 @@ def visit_table(self, table, asfrom=False, iscrud=False, ashint=False, ) return self.__add_catalog(sql, table) - def __add_catalog(self, sql: str, table: FromClause) -> str: + def __add_catalog(self, sql, table): if table is None: return sql