[sqlalchemy] When building a query, option to only join once

2021-11-26 Thread Michael Elsdörfer
I keep running into this issue where I have a complex set of filter parameters, some of which need a join, and it would be nice to have an ergonomic way to say: join this table, but not if there already is a join. I found this old post on the subject:

[sqlalchemy] How about: Disabling relationship cascades on a per-object basis.

2017-11-29 Thread Michael Elsdörfer
So, I've been a very happy user of SQLAlchemy over many years, though maybe not very deeply. I certainly don't really feel qualified to contribute any thoughts on it's design, but I did want to bring this up, since it's something I have run into again and again. I'd say that in the majority of

[sqlalchemy] Joins: Returning multiple instances, and a potential bug

2010-10-31 Thread Michael Elsdörfer
I'm sorry if this is an obvious question, but there seem to be a couple ways to do joins, and I seem unable to find an example explaining how to achieve my particular result. I need to join two tables, and I want the mapper objects of both tables returned. Essentially, I want

[sqlalchemy] Re: Working with mapper objects without saving them

2010-10-27 Thread Michael Elsdörfer
Thanks, that looks like pretty much the thing I need. Although, as a note, I mostly define my relationships in the opposite direction than then example in the documentation; That is, I define a order relationship in the Item model, with a items backref, which I suppose is just a question of

[sqlalchemy] Inter-Inheritance ForeignKeys - just need some assurance I'm doing it right

2010-08-25 Thread Michael Elsdörfer
I have, simplified, the following models: class Booking(db.Model): id = db.Column(db.Integer, primary_key=True) class PlanBooking(Booking): id = db.Column(db.Integer, db.ForeignKey(Booking.id), primary_key=True) class FeatureBooking(Booking): id = db.Column(db.Integer,