Re: [sqlalchemy] event updating sibling objects: commit() vs. flush()

2021-02-06 Thread Gord Thompson
Thanks, Mike. I was tempted to try and find a way to get at the session from within the event handler but thought that it might be a "Bad Idea"™ given that we were only given the `connection` to play with. Your suggestion works fine in 1.4. (As I mentioned in one of the dev meetings, I'm now an

[sqlalchemy] Re: SQLAlchemy join/has query with example code

2021-02-06 Thread Chris Simpson
After posting, I have arrived at *a* solution (which might be awful) Please let me know if this is a bad approach or I'm following the api correctly: I have converted this SQL query: SELECT COUNT(*) FROM person JOIN subscription ON person.id = subscription.person_id JOIN plan ON subscription.sk

[sqlalchemy] SQLAlchemy join/has query with example code

2021-02-06 Thread Chris Simpson
Hello, I'm trying to convert this working SQL query: (SQLAlchemy models are below) SELECT COUNT(*) FROM person JOIN subscription ON person.id = subscription.person_id JOIN plan ON subscription.sku_uuid = plan.uuid JOIN plan_requirements ON plan.id = plan_requirements.plan_id WHERE plan_requireme