[sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread gpitel
object (your own application class) maintain the > collection of objects in memory, and another object again (the session) > control the flow of data to/from the database. > > Sorry, I'm not sure if I'm being clear here or if I'm rambling a bit. Does > any of that make

[sqlalchemy] Re: Initialize model by its primary key.

2012-01-15 Thread gpitel
  if not test0: >                 test0 = Test0() >                 self.session.add(test0) >             return test0 > > I may have misunderstood exactly what you were trying to accomplish, but does > that help? > > > > > > > > -Original Message- > From

[sqlalchemy] Initialize model by its primary key.

2012-01-15 Thread gpitel
I am trying to setup my model initialization in two different ways. 1.) Initialize normally by creating an instance, e.g., test0=Test0('Title') 2.) Initialize by query, using an input integer as the primary key, e.g., test0=Test(32) This posses two questions. Is it common practice to put a sessio