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

2022-06-06 Thread Jason Hoppes
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 SQ

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

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

[sqlalchemy] Re: sqlalchemy.exc.UnboundExecutionError

2022-05-17 Thread Jason Hoppes
I found my error It was in the logic. Thank you for taking the time to read. - Jason On Tuesday, May 17, 2022 at 4:51:49 PM UTC-4 Jason Hoppes wrote: > I am getting an exception: > > sqlalchemy.exc.UnboundExecutionError: Could not locate a bind configured > on mapper mapped class

[sqlalchemy] sqlalchemy.exc.UnboundExecutionError

2022-05-17 Thread Jason Hoppes
I am getting an exception: sqlalchemy.exc.UnboundExecutionError: Could not locate a bind configured on mapper mapped class User->users, SQL expression or this Session. My engine creation code is in a static method of a class and is as follows: db_url =

Re: [sqlalchemy] Session within a session

2022-04-29 Thread Jason Hoppes
h and it will be fine. > > On Wed, Apr 20, 2022, at 11:28 AM, Jason Hoppes wrote: > > I have an object that adds a user. I have another Object that gets cipher > information for that user's password. Each one having their own session. > Could I call the object that gets the cipher

Re: [sqlalchemy] query many-many with asssociation table

2022-04-29 Thread Jason Hoppes
n > > > On Tue, Apr 5, 2022 at 9:48 PM Jason Hoppes > wrote: > >> I want to select all users in a particular group. I have a users table, >> user_groups table, and a users_group_users_asc table to associate the two. >> Note this is not a self referencing relati

[sqlalchemy] Session within a session

2022-04-20 Thread Jason Hoppes
I have an object that adds a user. I have another Object that gets cipher information for that user's password. Each one having their own session. Could I call the object that gets the cipher with a separate session with the session that I add the user? Effectively it does a lookup using an

[sqlalchemy] query many-many with asssociation table

2022-04-05 Thread Jason Hoppes
I want to select all users in a particular group. I have a users table, user_groups table, and a users_group_users_asc table to associate the two. Note this is not a self referencing relationship there are three different tables involved not two like the example in the documentation. I have the