[sqlalchemy] Re: Get the row count from a query

2022-06-03 Thread Jason Hoppes
I believe I finally found a solution: select(func.count(User.id_)).where(User.id_ == id) Thank you for taking the time to look. On Friday, June 3, 2022 at 1:45:39 PM UTC-4 Jason Hoppes wrote: > I would like to generate the following SQL using the ORM. I am testing for > no rows returning: > >

[sqlalchemy] Get the row count from a query

2022-06-03 Thread Jason Hoppes
I would like to generate the following SQL using the ORM. I am testing for no rows returning: select count(*) from users where id = I found session.query(User.id_).count() however that does not have a where clause. How would this be performed in the ORM with a where clause? Thanks, Jason