query.py 文件源码

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

项目:asyncqlio 作者: SunDwarf 项目源码 文件源码
def map_many(self, *rows: typing.Mapping[str, typing.Any]):
        """
        Maps many records to one row.

        This will group the records by the primary key of the main query table, then add additional
        columns as appropriate.
        """
        # this assumes that the rows come in grouped by PK on the left
        # also fuck right joins
        # get the first row and construct the first table row using map_columns
        # this will also map any extra relationship data there
        first_row = rows[0]
        tbl_row = self.map_columns(first_row)

        # loop over every "extra" rows
        # and update the relationship data in the table
        for runon_row in rows[1:]:
            tbl_row._update_relationships(runon_row)
            pass

        return tbl_row

    # Helper methods for natural builder-style queries
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号