def get_indexes(self, table_name: str = None) \
-> 'typing.Generator[md_index.Index, None, None]':
"""
Yields a :class:`.md_index.Index` for each index in the specified table,
or for each index in the schema if no table is specified.
These indexes don't point to a :class:`.md_table.Table` since there
might not be one, but they have a table_name attribute.
:param table_name: The table to get indexes from, or all tables if omitted
"""
params = {"table_name": table_name}
emitter = self.bind.emit_param
sql = self.bind.dialect.get_index_sql(table_name, emitter=emitter)
cur = await self.transaction.cursor(sql, params)
records = await cur.flatten()
await cur.close()
return self.bind.dialect.transform_rows_to_indexes(*records, table_name=table_name)
评论列表
文章目录