Re: [sqlalchemy] Session management for general functions within a class

2022-04-29 Thread Andrew Martin
Hi Simon, thank you for your thoughts. Sorry about the incomplete code. This project has gotten out of control, and I'm tired and a little burned out and have a launch deadline for Monday, and I was hoping this would be enough to uncover some basic stupidity in my approach. As long as I don't

[sqlalchemy] Problem with PG ARRAY's ANY() and SA 1.4.36 (maybe related resolution of #6515 ?)

2022-04-29 Thread Lele Gaifax
Hi all, I'm hitting what is either a regression or a "deprecated" usage of PG ARRAY's any() method, trying to upgrade an app of mine from SA 1.4.35 to SA 1.4.36. The issue is within a quite complex query, with a filter expression like the following: query = query.filter(((CC.languages ==

Re: [sqlalchemy] Session within a session

2022-04-29 Thread Jason Hoppes
Sorry I got diverted on another project. I will try this later and let you know. Thanks for your help. - Jason On Wednesday, April 20, 2022 at 8:45:39 PM UTC-4 Mike Bayer wrote: > you can work with multiple sessions and their objects simultaneously, with > the provision that you don't add()

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

2022-04-29 Thread Jason Hoppes
Thanks Simon this worked. - Jason On Wednesday, April 6, 2022 at 6:26:51 AM UTC-4 Simon King wrote: > I think it should work if you join to the *relationship* explicitly > > ie. > > session.query(User).join(User.user_groups).filter(...) > > Hope that helps, > > Simon > > > On Tue, Apr 5, 2022

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

2022-04-29 Thread Hoppes, Jason
Thank you Simon you solved my problem On Wed, Apr 6, 2022 at 6:26 AM Simon King wrote: > I think it should work if you join to the *relationship* explicitly > > ie. > > session.query(User).join(User.user_groups).filter(...) > > Hope that helps, > > Simon > > > On Tue, Apr 5, 2022 at 9:48 PM

Re: [sqlalchemy] Session management for general functions within a class

2022-04-29 Thread Simon King
It's difficult to debug this without a script that we can run to reproduce the problem. What kind of object is self.db_session? You use it as a context manager without calling it, so I don't think it can be a sessionmaker or a session. You're nesting calls to the context manager: # in