[sqlalchemy] Re: Can't determine join between 'engines' and 'versions'. Please specify the 'onclause' of this join explicitly ?

2009-05-23 Thread sniipe
I wrote in my first post, that I am expecting result in SQL - close to this one select e.id, e.type_id, tv.version as min_version, tv2.version as max_version from engines e join versions tv on(e.min_version_id=tv.id) join versions tv2 on(e.max_version_id=tv2.id) where '7.0.1.32' between

[sqlalchemy] Re: Can't determine join between 'engines' and 'versions'. Please specify the 'onclause' of this join explicitly ?

2009-05-23 Thread Michael Bayer
On May 23, 2009, at 5:58 AM, sniipe wrote: I wrote in my first post, that I am expecting result in SQL - close to this one select e.id, e.type_id, tv.version as min_version, tv2.version as max_version from engines e join versions tv on(e.min_version_id=tv.id) join versions tv2

[sqlalchemy] Re: Can't determine join between 'engines' and 'versions'. Please specify the 'onclause' of this join explicitly ?

2009-05-22 Thread Michael Bayer
sniipe wrote: Hi :) I have three tables: 1) t_version = sa.Table(versions, meta.metadata, sa.Column(id, sa.types.Integer(), primary_key=True, autoincrement=True), sa.Column(version, mysql.MSChar(length=100, collation='utf8_polish_ci'), nullable=False, unique=True) ) class

[sqlalchemy] Re: Can't determine join between 'engines' and 'versions'. Please specify the 'onclause' of this join explicitly ?

2009-05-22 Thread sniipe
Ok It's working but I can't use 'between': engine = meta.Session.query(Engine).outerjoin((Version, Engine.min_version_id==Version.id)).filter(between(request.POST ['version'], Engine.min_version.version, Engine.max_version.version)).all() and I've got error: AttributeError: Neither

[sqlalchemy] Re: Can't determine join between 'engines' and 'versions'. Please specify the 'onclause' of this join explicitly ?

2009-05-22 Thread Michael Bayer
Engine.min_version and max_version are instrumented column attributes. they don't have an attribute called version. i think you want between(x, Engine.min_version, Engine.max_version). sniipe wrote: Ok It's working but I can't use 'between': engine =

[sqlalchemy] Re: Can't determine join between 'engines' and 'versions'. Please specify the 'onclause' of this join explicitly ?

2009-05-22 Thread Michael Bayer
that means min_version and max_version aren't columns.I guess you're looking for Version.version, in which case you probably need to JOIN to that table twice on both the min_version and max_version. write (and test) the query you want in SQL first to get an idea for what you're doing.