def get_columns(self, table_name: str = None) \
-> 'typing.Generator[md_column.Column, None, None]':
"""
Yields a :class:`.md_column.Column` for each column in the specified table,
or for each column in the schema if no table is specified.
These columns don't point to a :class:`.md_table.Table` since there
might not be one, but accessing __name__ and __tablename__ of the column's
table will still work as expected.
: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_column_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_columns(*records, table_name=table_name)
评论列表
文章目录