I am using the package pyhive to create a sqlalchemy engine to connect pandas and Hive. For some reason, today I started getting KeyError for a particular type_code (17) after the server I work on was reset. I have only ever installed Thrift via pip, and I don't have a good idea of how it works. From what I understand, thrift will autogenerate some sort of Python file (TCLIService?) that I cannot directly import, and then the pyhive code runs off of that. Is there any way to regenerate this file to fix this problem, or does anyone have experience with a similar problem? Here is the full stack trace:
----> 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