Hi

i tried the following example, but i cant get the join to work:

CREATE TABLE product (

   id                INTEGER,
   price           NUMERIC(15,2) NOT NULL,

   PRIMARY KEY(id)
);

CREATE TABLE i18n_product (
   id                       INTEGER,
   lang                   VARCHAR(2),
   description        VARCHAR(150) NOT NULL,

   PRIMARY KEY(id, lang),
   FOREIGN KEY(id) REFERENCES product(id)
);

python:

class Product(Base):
    __table__ = Table('product', Base.metadata, autoload=True)

class I18NProduct(Base):
    __table__ = Table('i18n_product', Base.metadata, autoload=True)
    product = relation(Product, backref=backref('i18n'))

x=session.query(Product).filter(Product.id==1183).join('i18n').filter
(I18NProduct.lang=='en').one()

the sql looks of the JOIN looks good, but if i access x.i18n, another
queries is build which returns all of my language entry for one
product, what i try to get is one product description in the given
language.

please tell me how to do that correctly, thank you :)

cheers
Dom

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to