ddlsession.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:asyncqlio 作者: SunDwarf 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号