Re: [sqlalchemy] Use custom datetime type for all datetime column with autoload

2013-07-18 Thread Michael Bayer
the most straightforward way is to use an event: from sqlalchemy.schema import Table from sqlalchemy import event @event.listens_for(Table, column_reflect) def set_utc_date(inspector, table, column_info): if isinstance(column_info['type'], DateTime): column_info['type'] =

Re: [sqlalchemy] nested transaction syntax is a bit odd ( wishlist? )

2013-07-18 Thread Jonathan Vanasco
Could something be added to the docs then to elaborate on how the context manager works in regards to how things are committed/rolledback ? I just added comments to the existing example ( http://docs.sqlalchemy.org/en/rel_0_8/orm/session.html?highlight=begin_nested#using-savepoint )

Re: [sqlalchemy] nested transaction syntax is a bit odd ( wishlist? )

2013-07-18 Thread Michael Bayer
sure On Jul 18, 2013, at 12:00 PM, Jonathan Vanasco jvana...@gmail.com wrote: Could something be added to the docs then to elaborate on how the context manager works in regards to how things are committed/rolledback ? I just added comments to the existing example (

Re: [sqlalchemy] Use custom datetime type for all datetime column with autoload

2013-07-18 Thread Rit Li
That works! Thank you, Michael. On Thu, Jul 18, 2013 at 7:02 AM, Michael Bayer mike...@zzzcomputing.comwrote: the most straightforward way is to use an event: from sqlalchemy.schema import Table from sqlalchemy import event @event.listens_for(Table, column_reflect) def

[sqlalchemy] Is definting a commit method good design?

2013-07-18 Thread Victor Reichert
HI All, I'm working on my first SQL Alchemy project. I'm thinking I'm going to define a commit method for all the objects I want persist, I'm thinking something like: def commit(self): session = Session() #Session is a global sessionmaker session.add(self)

Re: [sqlalchemy] Is definting a commit method good design?

2013-07-18 Thread Mauricio de Abreu Antunes
Well, session should be a global variable, but keep in mind that everytime you call commit, you are recreating session. 2013/7/18 Victor Reichert vfr...@gmail.com: HI All, I'm working on my first SQL Alchemy project. I'm thinking I'm going to define a commit method for all the objects I want

Re: [sqlalchemy] Is definting a commit method good design?

2013-07-18 Thread Michael Bayer
On Jul 18, 2013, at 6:52 PM, Victor Reichert vfr...@gmail.com wrote: HI All, I'm working on my first SQL Alchemy project. I'm thinking I'm going to define a commit method for all the objects I want persist, I'm thinking something like: def commit(self): session =

Re: [sqlalchemy] Is definting a commit method good design?

2013-07-18 Thread Mauricio de Abreu Antunes
meaning that a single commit() should address all the objects that are related to a particular operation. i commited it to my mind. :) 2013/7/18 Michael Bayer mike...@zzzcomputing.com: On Jul 18, 2013, at 6:52 PM, Victor Reichert vfr...@gmail.com wrote: HI All, I'm working on my first SQL