Python中的Thrift错误 - >蜂巢连接

时间:2015-06-14 18:59:29

标签: python pandas hive thrift

我正在使用套餐pyhive 创建一个sqlalchemy引擎来连接pandas和Hive。出于某种原因,今天我开始在我工作的服务器重置后获取特定type_code(17)的KeyError。我只是通过pip安装了Thrift,我不知道它是如何工作的。根据我的理解,thrift会自动生成某些我无法直接导入的Python文件(TCLIService?),然后pyhive代码会运行。有没有办法重新生成此文件来解决此问题,还是有人有类似问题的经验?这是完整的堆栈跟踪:

----> 1 pd.read_sql_query("select * FROM table", engine)

/anaconda/lib/python2.7/site-packages/pandas/io/sql.pyc in read_sql_query(sql, con, index_col, coerce_float, params, parse_dates, chunksize)
    399     return pandas_sql.read_query(
    400         sql, index_col=index_col, params=params, coerce_float=coerce_float,
--> 401         parse_dates=parse_dates, chunksize=chunksize)
    402
    403

/anaconda/lib/python2.7/site-packages/pandas/io/sql.pyc in read_query(self, sql, index_col, coerce_float, parse_dates, params, chunksize)
   1082         args = _convert_params(sql, params)
   1083
-> 1084         result = self.execute(*args)
   1085         columns = result.keys()
   1086

/anaconda/lib/python2.7/site-packages/pandas/io/sql.pyc in execute(self, *args, **kwargs)
    976     def execute(self, *args, **kwargs):
    977         """Simple passthrough to SQLAlchemy engine"""
--> 978         return self.engine.execute(*args, **kwargs)
    979
    980     def read_table(self, table_name, index_col=None, coerce_float=True,

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in execute(self, statement, *multiparams, **params)
   1749
   1750         connection = self.contextual_connect(close_with_result=True)
-> 1751         return connection.execute(statement, *multiparams, **params)
   1752
   1753     def scalar(self, statement, *multiparams, **params):

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in execute(self, object, *multiparams, **params)
    719         """
    720         if isinstance(object, util.string_types[0]):
--> 721             return self._execute_text(object, multiparams, params)
    722         try:
    723             meth = object._execute_on_connection

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_text(self, statement, multiparams, params)
    868             statement,
    869             parameters,
--> 870             statement, parameters
    871         )
    872         if self._has_events or self.engine._has_events:

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/base.pyc in _execute_context(self, dialect, constructor, statement, parameters, *args)
    973         # create a resultproxy, get rowcount/implicit RETURNING
    974         # rows, close cursor if no further results pending
--> 975         result = context.get_result_proxy()
    976         if context.isinsert:
    977             if context._is_implicit_returning:

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/default.pyc in get_result_proxy(self)
    767
    768     def get_result_proxy(self):
--> 769         return result.ResultProxy(self)
    770
    771     @property

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/result.pyc in __init__(self, context)
    401         self._echo = self.connection._echo and \
    402             context.engine._should_log_debug()
--> 403         self._init_metadata()
    404
    405     def _init_metadata(self):

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/result.pyc in _init_metadata(self)
    404
    405     def _init_metadata(self):
--> 406         metadata = self._cursor_description()
    407         if metadata is not None:
    408             self._metadata = ResultMetaData(self, metadata)

/anaconda/lib/python2.7/site-packages/sqlalchemy/engine/result.pyc in _cursor_description(self)
    514         """May be overridden by subclasses."""
    515
--> 516         return self._saved_cursor.description
    517
    518     def close(self, _autoclose_connection=True):

/anaconda/lib/python2.7/site-packages/pyhive/hive.pyc in description(self)
    211                 else:
    212                     type_id = primary_type_entry.primitiveEntry.type
--> 213                     type_code = ttypes.TTypeId._VALUES_TO_NAMES[type_id]
    214                 self._description.append((
    215                     col.columnName.decode('utf-8'), type_code.decode('utf-8'),

KeyError:17

0 个答案:

没有答案