I attempted to use the solution Michael Nelson suggested:
from storm.expr import Column id = Column('id', tables[0]) result.count(expr=id, distinct=True)
This worked for many cases but failed when my result was a ResultSet created by the union of two intermediate ResultSets. It failed with:
ProgrammingError: missing FROM-clause entry for table "person" LINE 1: SELECT COUNT(DISTINCT Person.id) FROM ((SELECT Person.accoun...
This error was raised despite the fact the two intermediate ResultSets had Person in the FROM-clause.
After re-arranging my code to only issue a single query and avoid the union the above work-around worked.
I attempted to use the solution Michael Nelson suggested:
from storm.expr import Column count(expr= id, distinct=True)
id = Column('id', tables[0])
result.
This worked for many cases but failed when my result was a ResultSet created by the union of two intermediate ResultSets. It failed with:
ProgrammingError: missing FROM-clause entry for table "person"
LINE 1: SELECT COUNT(DISTINCT Person.id) FROM ((SELECT Person.accoun...
This error was raised despite the fact the two intermediate ResultSets had Person in the FROM-clause.
After re-arranging my code to only issue a single query and avoid the union the above work-around worked.