Revisiting this question, with coalesce. The target sql is:
SELECT
letter
,COALESCE(cache_counted, 0) AS counted
FROM letters
ORDER BY counted DESC
The closest I can get to it is this:
dbSession.query(
sqlalchemy.func.count( model.Letters.letter ),
sqlalchemy.func.coalesce( model.Letters.cache_counted,
0).label('counted'),
).order_by(
sqlalchemy.func.coalesce( model.Letters.cache_counted, 0).desc
)
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.