[sqlalchemy] insertion of an object with a user defined field value

2009-11-09 Thread (e.g. emre)
Hi, I have the following 2 declarative objects to represent a book and its pages: class Book(Base): __tablename__ = 'books' id = Column(Integer, primary_key=True) title = Column(String(32)) class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True)

[sqlalchemy] Re: insertion of an object with a user defined field value

2009-11-09 Thread (e.g. emre)
Thanks for the quick response. However, the problem I face is not being able to access the id assigned by database but not being able to modify the corresponding field in Page instance. To be more clear: bk_ids = {} for title in ('Tom Sawyer', 'Huck Finn'): book = Book(title=title)

[sqlalchemy] Re: insertion of an object with a user defined field value

2009-11-09 Thread (e.g. emre)
It does indeed! It is my bad, it works as expected, the problem was due to not flushing properly before storing the values in the dictionary. Sorry for the inconvenience and thank you for the support. On Nov 9, 4:46 pm, Mike Conley mconl...@gmail.com wrote: Using your class definitions, it