Re: [sqlalchemy] Do not add entities automatically to the session?

2013-07-22 Thread Sebastian Elsner
Are you doing any relationship assignments in the User constructor? Because if the assigned object is in a session the User will also be put in the same one automatically. Otherwise the default behaviour is exactly what you expect. If you do a: print session.new, you should not see anything in

[sqlalchemy] Do not add entities automatically to the session?

2013-07-22 Thread Michel Albert
Hi, I realised that SA adds an instance to the session as soon as I instantiate it. How/Where can I disable this? For example: currently I have this behaviour: >>> session = get_session() >>> my_user = User(email='f...@example.com') >>> len(session.query(User)) 1 but instead I would like to

Re: [sqlalchemy] Do not add entities automatically to the session?

2013-07-22 Thread Michael Bayer
On Jul 22, 2013, at 10:22 AM, Michel Albert wrote: > Hi, > > > I realised that SA adds an instance to the session as soon as I instantiate > it. How/Where can I disable this? > > For example: currently I have this behaviour: > > >>> session = get_session() > >>> my_user = User(email='f...@e