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

2022-06-06 Thread Jason Hoppes
Thank you Sergey. On Saturday, June 4, 2022 at 7:08:25 AM UTC-4 Sergey V. wrote: > An alternative would be > > session.query(User).filter(User.id_ == id).count() > > On Saturday, June 4, 2022 at 4:45:49 AM UTC+10 jason@stormfish-sci.com > wrote: > >> I believe I finally found a solution: >>

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

2022-06-04 Thread Sergey V.
An alternative would be session.query(User).filter(User.id_ == id).count() On Saturday, June 4, 2022 at 4:45:49 AM UTC+10 jason@stormfish-sci.com wrote: > I believe I finally found a solution: > > select(func.count(User.id_)).where(User.id_ == id) > > Thank you for taking the time to

[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: >