in python-phoenixdb/phoenixdb/sqlalchemy_phoenix.py [0:0]
def get_indexes(self, connection, table_name, schema=None, **kw):
if schema is None:
schema = ''
raw = _get_dbapi(connection).meta().get_index_info(schema=schema, table=table_name)
# We know that Phoenix returns the rows ordered by INDEX_NAME and ORDINAL_POSITION
cooked = []
current = None
for row in raw:
if current is None or row['INDEX_NAME'] != current['name']:
current = {
'name': row['INDEX_NAME'],
'unique': not row['NON_UNIQUE'] is False,
'column_names': [],
}
cooked.append(current)
# Phoenix returns the column names in its internal representation here
# Remove the default CF prefix
canonical_name = row['INDEX_NAME']
if canonical_name.startswith('0:'):
canonical_name = canonical_name[len(':0')]
if canonical_name.startswith(':'):
canonical_name = canonical_name[len(':')]
current['column_names'].append(canonical_name)
return cooked