Skip to content

Commit 1f99552

Browse files
authored
Use str type for driver and name in HiveDialect (#450)
PyHive's HiveDialect usage of bytes for the name and driver fields is not the norm is causing issues upstream: apache/superset#22316 Even other dialects within PyHive use strings. SQLAlchemy does not strictly require a string, but all the stock dialects return a string, so I figure it is heavily implied. I think the risk of breaking something upstream with this change is low (but it is there ofc). I figure in most cases we just make someone's `str(dialect.driver)` expression redundant. Examples for some of the other stock sqlalchemy dialects (name and driver fields using str): https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/sqlite/pysqlite.py#L501 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/sqlite/base.py#L1891 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/mysql/base.py#L2383 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/mysql/mysqldb.py#L113 https://github.com/zzzeek/sqlalchemy/blob/main/lib/sqlalchemy/dialects/mysql/pymysql.py#L59
1 parent 3547bd6 commit 1f99552

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pyhive/sqlalchemy_hive.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def _translate_colname(self, colname):
228228

229229

230230
class HiveDialect(default.DefaultDialect):
231-
name = b'hive'
232-
driver = b'thrift'
231+
name = 'hive'
232+
driver = 'thrift'
233233
execution_ctx_cls = HiveExecutionContext
234234
preparer = HiveIdentifierPreparer
235235
statement_compiler = HiveCompiler

0 commit comments

Comments
 (0)