spacetime.py 文件源码

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

项目:triage 作者: dssg 项目源码 文件源码
def get_join_table(self):
        """
        Generates a join table, consisting of an entry for each combination of
        groups and dates in the from_obj
        """
        groups = list(self.groups.values())
        intervals = list(set(chain(*self.intervals.values())))

        queries = []
        for date in self.dates:
            columns = groups + [ex.literal_column("'%s'::date" % date).label(
                    self.output_date_column)]
            queries.append(ex.select(columns, from_obj=self.from_obj)
                             .where(self.where(date, intervals))
                             .group_by(*groups))

        return str.join("\nUNION ALL\n", map(str, queries))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号