Re: [sqlalchemy] server_default argument in Column(DateTime, server_default = ...)

2010-10-16 Thread Michael Bayer
func.now() will translate into the appropriate construct for a given backend, so server_default=func.now() will do it. On Oct 15, 2010, at 9:01 PM, Domingo Aguilera wrote: HI, I wonder if there's a way to use server_default in Column ( DateTime, server_default = ...) to make a database

Re: [sqlalchemy] String formatting issues with connection.execute(sql_str)

2010-10-16 Thread Michael Bayer
On Oct 15, 2010, at 10:20 AM, William Furnass wrote: Trying to follow the SQLA tutorial at http://mapfish.org/doc/tutorials/sqlalchemy.html but find that I get stuck at the first hurdle (the Engine API bit) due to a string formatting problem: sqlalchemy.exc.ProgrammingError:

Re: [sqlalchemy] orm object, before after

2010-10-16 Thread Michael Hipp
On 8/24/2010 9:47 PM, Michael Bayer wrote: Michael Hipp wrote: How do I make a copy of an orm object such that modifications to the copy do not affect the original? The mapped object has a member _sa_instance_state that you basically don't want to transfer to your new object.You want it

Re: [sqlalchemy] orm object, before after

2010-10-16 Thread Michael Bayer
On Oct 16, 2010, at 1:02 PM, Michael Hipp wrote: On 8/24/2010 9:47 PM, Michael Bayer wrote: Michael Hipp wrote: How do I make a copy of an orm object such that modifications to the copy do not affect the original? The mapped object has a member _sa_instance_state that you basically don't

Re: [sqlalchemy] orm object, before after

2010-10-16 Thread Michael Hipp
On 10/16/2010 12:52 PM, Michael Bayer wrote: On Oct 16, 2010, at 1:02 PM, Michael Hipp wrote: On 8/24/2010 9:47 PM, Michael Bayer wrote: Michael Hipp wrote: How do I make a copy of an orm object such that modifications to the copy do not affect the original? The mapped object has a member

Re: [sqlalchemy] orm object, before after

2010-10-16 Thread Michael Bayer
On Oct 16, 2010, at 2:03 PM, Michael Hipp wrote: On 10/16/2010 12:52 PM, Michael Bayer wrote: On Oct 16, 2010, at 1:02 PM, Michael Hipp wrote: On 8/24/2010 9:47 PM, Michael Bayer wrote: Michael Hipp wrote: How do I make a copy of an orm object such that modifications to the copy do not

Re: [sqlalchemy] orm object, before after

2010-10-16 Thread Michael Hipp
On 10/16/2010 1:55 PM, Michael Bayer wrote: On Oct 16, 2010, at 2:03 PM, Michael Hipp wrote: On 10/16/2010 12:52 PM, Michael Bayer wrote: On Oct 16, 2010, at 1:02 PM, Michael Hipp wrote: On 8/24/2010 9:47 PM, Michael Bayer wrote: Michael Hipp wrote: How do I make a copy of an orm object

[sqlalchemy] Query help

2010-10-16 Thread rake
Table structure: A(id, name) B(id, name, A_id) C(id, name, B_id) one-to-many A-B and B-C I'm trying to use session.query() to select all rows of A such that none of the joined B rows have any joined C rows. A: (1,'A1') (2,'A2') B: (1,'B1',1) (2,'B2',1) (3,'B3',2) C: (1,'C1',1) So, it would

Re: [sqlalchemy] Query help

2010-10-16 Thread Conor
On 10/16/2010 03:31 PM, rake wrote: Table structure: A(id, name) B(id, name, A_id) C(id, name, B_id) one-to-many A-B and B-C I'm trying to use session.query() to select all rows of A such that none of the joined B rows have any joined C rows. A: (1,'A1') (2,'A2') B: (1,'B1',1)

Re: [sqlalchemy] orm object, before after

2010-10-16 Thread Michael Bayer
On Oct 16, 2010, at 4:02 PM, Michael Hipp wrote: On 10/16/2010 1:55 PM, Michael Bayer wrote: On Oct 16, 2010, at 2:03 PM, Michael Hipp wrote: On 10/16/2010 12:52 PM, Michael Bayer wrote: On Oct 16, 2010, at 1:02 PM, Michael Hipp wrote: On 8/24/2010 9:47 PM, Michael Bayer wrote: