[sqlalchemy] Re: Relations - How?

2008-09-24 Thread Alex K
Hello, Actually, you can join on any condition, not only on the relation condition, In this case your query needs to evolve from: .outerjoin((ATranslation,Book.translations))\ to: .outerjoin((ATranslation, and_(ATranslation.book_id == Book.isbn, ATranslati

[sqlalchemy] Re: Relations - How?

2008-09-23 Thread g00fy
One more thing, If i have just book and translations 1 Book has 3 translations this sql will create me 3 rows (due to the join) isbn translation_code translation_text 1en "The Book" 1ru "Книжка" 1pl "Ksiazka" so if i have 10 books i will h

[sqlalchemy] Re: Relations - How?

2008-09-23 Thread g00fy
Thnx a lot Alex! I already love Pylons and SQLAlchemy! On 23 Wrz, 12:16, Alex K <[EMAIL PROTECTED]> wrote: > Hello, here is the answer: > > # -*- coding: utf-8 -*- > > from sqlalchemy import create_engine > from sqlalchemy import Table, Column, Integer, String, Unicode, > MetaData, ForeignKey > f

[sqlalchemy] Re: Relations - How?

2008-09-23 Thread Alex K
Hello, here is the answer: # -*- coding: utf-8 -*- from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, Unicode, MetaData, ForeignKey from sqlalchemy.orm import sessionmaker, mapper, dynamic_loader,backref, relation, composite, comparable_property, contain