Re: [sqlalchemy] Automatic created and modified timestamp columns (best practice?!)

2013-04-03 Thread Julien Cigar
On 03/27/2013 14:26, Moritz Schlarb wrote: Hi there everyone, I am kind of looking for a best practice on how to implement automatically setting and updating columns for created and modified timestamps in SQLAlchemy, preferrably database-agnostic. First of all, is DateTime the appropriate

Re: [sqlalchemy] how to prepare get by primary key query?

2013-04-03 Thread Michael Bayer
On Apr 3, 2013, at 1:01 AM, Roman Yakovenko roman.yakove...@gmail.com wrote: Hello. I am just starting with SQLAlchemy and have a small problem: my get query is compiled every time I use it. According to cProfile: ncalls tottime percall cumtime percall filename:lineno(function) 10

Re: [sqlalchemy] discriminator_on_association example and association proxies

2013-04-03 Thread bruk.habtu
Hey Michael, Thanks for the speedy response. I went ahead and changed my implementation using the table_per_association example and everything works great. On Tuesday, 2 April 2013 16:49:14 UTC-4, Michael Bayer wrote: the Customer.comments attribute proxies through comment_association

[sqlalchemy] implementing one-to-many relationship?

2013-04-03 Thread James Hartley
I have implemented a (simplified) one-to-many relationship which works, but I suspect I am reimplementing functionality in a suboptimal fashion which is already done by SQLAlchemy. The following short example: 8--- #!/usr/bin/env python import datetime from sqlalchemy

[sqlalchemy] Re: Advice: Best practice for working with an existing database

2013-04-03 Thread Peter Herndon
On Friday, March 22, 2013 9:31:59 AM UTC-4, Jason wrote: Hi Peter, I think using a the declarative reflected style is a great way to integrate an existing database into your application. It sounds like you are doing this already, but in case you are not the reflection setup is

Re: [sqlalchemy] python: sqlalchemy - how do I ensure connection not stale using new event system

2013-04-03 Thread algotr8der
I think you nailed it. This is the problem. I will follow the approach you indicated. Thank you Michael. I appreciate it. On Tuesday, April 2, 2013 1:35:07 PM UTC-7, Michael Bayer wrote: if you're doing a query that is causing the database connection to simply fail, then you'd need to