

def intersect(self, qs):
    my_s = self.get_bare_select(columns=[self.table.c.pk]).cte()
    qs_s = qs.get_bare_select(columns=[self.table.c.pk]).cte()
    condition = self.table.c.pk.in_(expression.intersect(select([my_s.c.pk]), select([qs_s.c.pk])))
    new_qs = QuerySet(self.backend, self.table, self.cls, condition=condition, order_bys=self.order_bys, raw=self.raw, include=self.include, only=self.only)
    return new_qs

dataset/ETHPy150Open adewes/blitzdb/blitzdb/backends/sql/queryset.py QuerySet.intersect/original