I am using sqlalchemy with a database that doesn't support subselects. What that means is that something like this wouldn't work (where Calendar
is a model inheriting a declarative base):
Calendar.query.filter(uuid=uuid).count()
I am trying to override the count
method with something like this:
def count(self):
col = func.count(literal_column("'uuid'"))
return self.from_self(col).scalar()
However, the from_self
bit still does the subselect. I can't do something like this:
session.query(sql.func.count(Calendar.uuid)).scalar()
Because I want all the filter information from the Query
. Is there a way I can get the filter arguments for the current Query
without doing the subselect?
Thanks~