From: "Vlad K." <v...@haronmedia.com>
Date: Tue, 02 Oct 2012 12:28:16 +0200
Local: Tues, Oct 2 2012 6:28 am
Subject: Re: [sqlalchemy] Double many-to-many relation filter headache
On 10/01/2012 04:48 PM, Michael Bayer wrote:
> If I understand correctly, this isn't accurate. Your query needs the usage of query.join(), and this usage is not related to whether or not you supply a complete entity to select from.
I wasn't using explicit .join(), except an outerjoin on a one-to-one relation with images table (which by default is lazyloaded). I thought SQLA would figure it out itself based on foreign keys, as it usually does. Maybe that's wrong, maybe I should be explicit, but so far it worked (when entire instances of declarative_base were given to session.query()). I forgot to mention, and this could be the cause of perceived problems, What happened was that the query returned a list of named tuples for > I'm not sure what "won't automatically process inner joins" means, does that mean, you get an error message, or you're forced to call .join() as opposed to some other system of joining two entites, or what.
I mean the cartesian cross-product in queries with many-to-many relations. SQLA would "automatically" recognize the queried models and construct the model instances and their relationships properly. E.g. if I query for single model that has X related in a many-to-many I hope I'm making sense here. :)
I guess I should make a minimal example case for this, and will do as -- .oO V Oo.
Work Hard,
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||