

def __len__(self):
    if (self.count is None):
        if (self.objects is not None):
            self.count = len(self.objects)
        else:
            with self.backend.transaction():
                count_select = self.get_count_select()
                result = self.backend.connection.execute(count_select)
                self.count = result.first()[0]
                result.close()
    return self.count

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