Thank you Michael ,

> you only need a single relation() + backref(), "books<->stock".

did you mean like this ?


class Stock(declarative_base):
      __tablename__ = 'tbl_stock'
      ....
      ....
      ....
      pass

class Book(declarative_base):
      __tablename__ = 'tbl_books'
      ....
      ....
      stock = relation('Stock', backref=backref
('tbl_books',order_by=id))


if so how can i retrieve all the books in a particular stock  ??
in my case i could have done it by

>>> ins_stock = session.querry(Stock).filter(id=100).one()
>>> print ins.stock.books
[<book1 object><book2 object> ...]
--~--~---------~--~----~------------~-------~--~----~
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