将caravel连接到配置单元服务器时,在加载表时会引发错误

时间:2016-07-07 03:38:35

标签: sqlalchemy hive

2016-07-06 19:39:09,153:ERROR:root:Compiler <sqlalchemy.sql.compiler.GenericTypeCompiler object at 0x10c75d150> can't render element of type <class 'impala.sqlalchemy.STRING'>
Traceback (most recent call last):
  File "/Users/user_name/.virtualenvs/caravel27/lib/python2.7/site-packages/caravel/models.py", line 771, in fetch_metadata
    datatype = "{}".format(col.type).upper()
  File "/Users/user_name/.virtualenvs/caravel27/lib/python2.7/site-packages/sqlalchemy/sql/type_api.py", line 481, in __str__
    return unicode(self.compile()).\
  File "/Users/user_name/.virtualenvs/caravel27/lib/python2.7/site-packages/sqlalchemy/sql/type_api.py", line 468, in compile
    return dialect.type_compiler.process(self)
  File "/Users/user_name/.virtualenvs/caravel27/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 261, in process
    return type_._compiler_dispatch(self, **kw)
  File "/Users/user_name/.virtualenvs/caravel27/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 79, in _compiler_dispatch
    raise exc.UnsupportedCompilationError(visitor, cls)

已报告类似问题here

但是,如果通过bind=engine

使用sqlalchemy,我不知道如何通过caravel

这是您可以复制错误的方法:

安装然后使用caravel runserver -d运行caravel。然后将hive2数据库添加到caravel。要做到这一点,你需要impyla。安装后使用它作为sqlAlchemyURL impala://somehostname.compute.amazonaws.com:10000/database_name?auth_mechanism=‌​PLAIN。测试连接应返回Seems OK。 Caravel还应该能够发现database_name中的所有表。但是,当我添加一个表时,caravel会将所有列标识为UNKNOWN类型。然后查看caravel发布的日志,并记录上面提到的错误。

1 个答案:

答案 0 :(得分:0)