[sqlalchemy] sqlalchemy check select query execution time

2010-10-28 Thread sajuptpm
How check select query execution time using sqlalchemy. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

[sqlalchemy] How can I change manually the value of field with onupdate option ? I would like override onupdate mechanism

2010-10-28 Thread KLEIN Stéphane
Hi, in my project, I use onupdate attribute : foobar_table = Table(FooBar, meta.metadata, ... Column(created, DateTime(), default=datetime.datetime.now), Column(modified, DateTime(), default=datetime.datetime.now, onupdate=datetime.datetime.now), ... ) All work great. However, my

Re: [sqlalchemy] Storing lists of simple strings

2010-10-28 Thread Torsten Landschoff
Hi Michael, Am Mittwoch, den 27.10.2010, 13:37 -0400 schrieb Michael Bayer: Configuration is too unwieldy ? Since you're using declarative , just using @declared_attr would give you access to the class: Nice one. I missed classproperty and declared_attr so far. def make_ordered_list(key,

[sqlalchemy] Can't adapt type on a Foreign key

2010-10-28 Thread Fabien
I got a problem with PostGreSQL 8.4 and tables reflection. My metadata object seems to be ok (it has foreign keys, primary keys, every columns and tables). But when I try to associate an object to an another one through a Foreign key, I get : sqlalchemy.exc.ProgrammingError: (ProgrammingError)

Re: [sqlalchemy] Can't adapt type on a Foreign key

2010-10-28 Thread Conor
On 10/28/2010 06:57 AM, Fabien wrote: I got a problem with PostGreSQL 8.4 and tables reflection. My metadata object seems to be ok (it has foreign keys, primary keys, every columns and tables). But when I try to associate an object to an another one through a Foreign key, I get :

Re: [sqlalchemy] How can I change manually the value of field with onupdate option ? I would like override onupdate mechanism

2010-10-28 Thread Alexandre Conrad
Not sure on this one, but are you passing a formatted date string? Maybe you should set a datetime object directly and let SA do the string conversion during flush. Alex Sent from my fantastic HTC Hero On Oct 28, 2010 1:41 AM, KLEIN Stéphane klein.steph...@gmail.com wrote: Hi, in my project,

Re: [sqlalchemy] sqlalchemy check select query execution time

2010-10-28 Thread Michael Bayer
Easiest way is to turn on logging using timestamps. A more integrative approach: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Profiling Also see: http://stackoverflow.com/questions/1171166/how-can-i-profile-a-sqlalchemy-powered-application/1175677#1175677 On Oct 28, 2010, at 3:38 AM,

Re: [sqlalchemy] Storing lists of simple strings

2010-10-28 Thread Michael Bayer
On Oct 28, 2010, at 5:20 AM, Torsten Landschoff wrote: Hi Michael, Am Mittwoch, den 27.10.2010, 13:37 -0400 schrieb Michael Bayer: Configuration is too unwieldy ? Since you're using declarative , just using @declared_attr would give you access to the class: Nice one. I missed

Re: [sqlalchemy] Storing lists of simple strings

2010-10-28 Thread Torsten Landschoff
Hi Michael, Am Donnerstag, den 28.10.2010, 11:36 -0400 schrieb Michael Bayer: Then the mapper is constructed which immediately replaces your function with an ORM instrumented attribute. So basically yes its a one shot. Thanks for the clarification. Greetings, Torsten -- DYNAmore

Re: [sqlalchemy] How can I change manually the value of field with onupdate option ? I would like override onupdate mechanism

2010-10-28 Thread Thadeus Burgess
I actually have this same issue as well.. I have a field that means the record has been tested. Any updates to the field make tested = False, all except for one other field. However when I updated that field and this field it still gets reset to false.. record.approved=True record.tested=True

Re: [sqlalchemy] How can I change manually the value of field with onupdate option ? I would like override onupdate mechanism

2010-10-28 Thread Thadeus Burgess
The only way around this is to do two separate commits record.approved = True db.session.commit() record.tested = True db.session.commit() record.approved is True record.tested is True -- Thadeus On Thu, Oct 28, 2010 at 2:22 PM, Thadeus Burgess thade...@thadeusb.comwrote: I actually have

Re: [sqlalchemy] How can I change manually the value of field with onupdate option ? I would like override onupdate mechanism

2010-10-28 Thread Michael Bayer
again, no reason why that should be the case from an ORM perspective, please provide a succinct and full working test case and I can evaluate what you're doing. On Oct 28, 2010, at 3:24 PM, Thadeus Burgess wrote: The only way around this is to do two separate commits record.approved = True

[sqlalchemy] Best way to get data from database

2010-10-28 Thread Alvaro Reinoso
Hey guys, I have a doubt. I need to get the data from the sever twice every time when I load a page, one to render the HTML and another one to get the data for client side (javascript). So I don't know exactly what it's the best way and fastest. I was trying to implement a session object and

[sqlalchemy] how to use object_session properly

2010-10-28 Thread anusha k
hello all I want to know how to create Session with object_session which can be used to add data to the database i.e using Session.add_all().So i can pass a list as parameter to add_all as my length of list is of variable length. When i am trying to do that i was not able to associate instance

Re: [sqlalchemy] how to use object_session properly

2010-10-28 Thread Conor
On 10/28/2010 08:16 PM, anusha k wrote: hello all I want to know how to create Session with object_session which can be used to add data to the database i.e using Session.add_all().So i can pass a list as parameter to add_all as my length of list is of variable length. When i am trying to do