Hi guys, I may be misunderstanding how SQLAlchemy works in this regard, but somehow I can't figure out how to do a joined query for ORM objects in a way that I can filter on related children objects and have them available (filtered) as attributes.
Take this snippet for example: https://pastebin.com/dACLYpYe - if I run it, I expect it to print me the company name ("ACME") and only one of the users ("Bob"), who is the active user. However, it's also bringing the other user saved in the database, "Alice", who is an inactive user. How can I make this work in such a way that I can access the main object I need, which is the company, and then loop through the users that belong to it, but respecting the filtering applied to the query? In the printed SQL statement the query is correct, but the results I get in my Python code are not, no matter if I flush and expire all objects before doing the query. Any ideas? Thanks in advance! Diogo -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/b21a1ad7-9a04-4c7e-b690-c02e22d92d6dn%40googlegroups.com.