How to do a safe (constraint) implicit join in SQLAlchemy? -
i consider safe join 1 constrained foreign key. , implicit 1 mentions target.
in sqlalchemy, session.query(user).join(addresse) might or might not constraint, depending on whether sqlalchemy knows relation between user , addresses.
sometimes construct complicated query , want make sure joins constraint. how can check that? best if sqlalchemy gives me exception when implicit .join(table) didn’t find foreign key...
example “complicated query”:
session.query(addr_alias1).join(user).join(addr_alias2)
for last join, overly explicit way .join(addr_alias2, user.addresses), said, want implicit syntax, barks if failed.
sqlalchemy so.
unfortunately, tutorial suggests otherwise , api documentation doesn’t clear up.
Comments
Post a Comment