зеркало из https://github.com/mozilla/PyHive.git
Родитель
0737803abb
Коммит
a0f470ed17
|
@ -129,7 +129,7 @@ class HiveCompiler(SQLCompiler):
|
||||||
return 'length{}'.format(self.function_argspec(fn, **kw))
|
return 'length{}'.format(self.function_argspec(fn, **kw))
|
||||||
|
|
||||||
|
|
||||||
if StrictVersion(sqlalchemy.__version__) >= StrictVersion('0.6.0'):
|
if StrictVersion(sqlalchemy.__version__) >= StrictVersion('0.7.0'):
|
||||||
class HiveTypeCompiler(compiler.GenericTypeCompiler):
|
class HiveTypeCompiler(compiler.GenericTypeCompiler):
|
||||||
def visit_INTEGER(self, type_):
|
def visit_INTEGER(self, type_):
|
||||||
return 'INT'
|
return 'INT'
|
||||||
|
|
|
@ -189,6 +189,7 @@ class PrestoDialect(default.DefaultDialect):
|
||||||
# requests gives back Unicode strings
|
# requests gives back Unicode strings
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
if StrictVersion(sqlalchemy.__version__) < StrictVersion('0.7.0'):
|
if StrictVersion(sqlalchemy.__version__) < StrictVersion('0.7.0'):
|
||||||
from pyhive import sqlalchemy_backports
|
from pyhive import sqlalchemy_backports
|
||||||
|
|
||||||
|
@ -196,3 +197,24 @@ if StrictVersion(sqlalchemy.__version__) < StrictVersion('0.7.0'):
|
||||||
insp = sqlalchemy_backports.Inspector.from_engine(connection)
|
insp = sqlalchemy_backports.Inspector.from_engine(connection)
|
||||||
return insp.reflecttable(table, include_columns, exclude_columns)
|
return insp.reflecttable(table, include_columns, exclude_columns)
|
||||||
PrestoDialect.reflecttable = reflecttable
|
PrestoDialect.reflecttable = reflecttable
|
||||||
|
else:
|
||||||
|
class PrestoTypeCompiler(compiler.GenericTypeCompiler):
|
||||||
|
def visit_CLOB(self, type_, **kw):
|
||||||
|
raise ValueError("Presto does not support the CLOB column type.")
|
||||||
|
|
||||||
|
def visit_NCLOB(self, type_, **kw):
|
||||||
|
raise ValueError("Presto does not support the NCLOB column type.")
|
||||||
|
|
||||||
|
def visit_DATETIME(self, type_, **kw):
|
||||||
|
raise ValueError("Presto does not support the DATETIME column type.")
|
||||||
|
|
||||||
|
def visit_FLOAT(self, type_, **kw):
|
||||||
|
return 'DOUBLE'
|
||||||
|
|
||||||
|
def visit_TEXT(self, type_, **kw):
|
||||||
|
if type_.length:
|
||||||
|
return 'VARCHAR({:d})'.format(type_.length)
|
||||||
|
else:
|
||||||
|
return 'VARCHAR'
|
||||||
|
|
||||||
|
PrestoDialect.type_compiler = PrestoTypeCompiler
|
||||||
|
|
Загрузка…
Ссылка в новой задаче