Open mggger opened 1 year ago
@mggger hi, did you solved this issue?
https://github.com/dropbox/PyHive/blob/master/pyhive/sqlalchemy_hive.py#L369
def get_indexes(self, connection, table_name, schema=None, **kw):
rows = self._get_table_columns(connection, table_name, schema)
# Strip whitespace
rows = [[col.strip() if col else None for col in row] for row in rows]
# Filter out empty rows and comment
rows = [row for row in rows if row[0] and row[0] != '# col_name']
for i, (col_name, _col_type, _comment) in enumerate(rows):
if col_name == '# Partition Information':
break
# Handle partition columns
col_names = []
for col_name, _col_type, _comment in rows[i + 1:]:
col_names.append(col_name)
if col_names:
return [{'name': 'partition', 'column_names': col_names, 'unique': False}]
else:
return []
i is not declare
i change code to and problem is ok
def get_indexes(self, connection, table_name, schema=None, **kw):
rows = self._get_table_columns(connection, table_name, schema)
# Strip whitespace
rows = [[col.strip() if col else None for col in row] for row in rows]
# Filter out empty rows and comment
rows = [row for row in rows if row[0] and row[0] != '# col_name']
index = -1
for i, (col_name, _col_type, _comment) in enumerate(rows):
if col_name == '# Partition Information':
index = i
break
# Handle partition columns
col_names = []
if index != -1:
for col_name, _col_type, _comment in rows[index + 1:]:
col_names.append(col_name)
if col_names:
return [{'name': 'partition', 'column_names': col_names, 'unique': False}]
else:
return []
Hi, I have met some errors: