[sqlalchemy] query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Kent
By design, when a query() fetches an existing object, it doesn't refresh the values unless populate_existing() is included with the query. The documentation for populate_existing() states it isn't meant for general purpose. Occasionally, however, objects need to be selected FOR UPDATE,

[sqlalchemy] Re: query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Kent
I imagine this gets ugly when autoflush is disabled... perhaps that is why it requires populate_existing()? On Tuesday, March 5, 2013 10:00:36 AM UTC-5, Kent wrote: By design, when a query() fetches an existing object, it doesn't refresh the values unless populate_existing() is included with

Re: [sqlalchemy] query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Michael Bayer
populate_existing() blows away any pending changes on the object so turning it on by default would be a surprise in a lot of cases. typically if someone is working with FOR UPDATE they're already programming a very specific section in a very careful manner, it's not something that's done

Re: [sqlalchemy] Postgres custom composite types

2013-03-05 Thread Michael Bayer
On Mar 5, 2013, at 9:45 AM, Jason ja...@deadtreepages.com wrote: Hello, I'm looking or some direction on how to implement the SQL syntax when querying Postgres' composite types. In case you're unfamiliar: the composite types in Postgres are a type that contains attributes which are

Re: [sqlalchemy] query of existing object won't refresh values (even when FOR UPDATE)

2013-03-05 Thread Kent
I had forgotten the danger of populate_existing() also because we make it automatically issue a flush() for these purposes. Documentation note sounds good. On 3/5/2013 10:45 AM, Michael Bayer wrote: populate_existing() blows away any pending changes on the object so turning it on by default

Re: [sqlalchemy] Postgres custom composite types

2013-03-05 Thread Jason
On Tuesday, March 5, 2013 11:09:00 AM UTC-5, Michael Bayer wrote: On Mar 5, 2013, at 9:45 AM, Jason ja...@deadtreepages.com javascript: wrote: Hello, I'm looking or some direction on how to implement the SQL syntax when querying Postgres' composite types. In case you're

Re: [sqlalchemy] Postgres custom composite types

2013-03-05 Thread Jason
On Tuesday, March 5, 2013 2:52:59 PM UTC-5, Jason wrote: On Tuesday, March 5, 2013 11:09:00 AM UTC-5, Michael Bayer wrote: On Mar 5, 2013, at 9:45 AM, Jason ja...@deadtreepages.com wrote: Hello, I'm looking or some direction on how to implement the SQL syntax when querying

[sqlalchemy] info property in column and relationship

2013-03-05 Thread Xin Wang
Hi all, I can get info dict passed to Column() via `Model.field.info`, but with relationship() I need to use `Model.field.property.info`. Not sure if it is an inconsistence, as both of them are instances of `InstrumentedAttribute` when retrive from model. BR, Xin Wang -- You received this

Re: [sqlalchemy] info property in column and relationship

2013-03-05 Thread Michael Bayer
.info on relationship is a new feature, that can be added. On Mar 5, 2013, at 7:10 PM, Xin Wang dram.w...@gmail.com wrote: Hi all, I can get info dict passed to Column() via `Model.field.info`, but with relationship() I need to use `Model.field.property.info`. Not sure if it is an

Re: [sqlalchemy] info property in column and relationship

2013-03-05 Thread Xin Wang
Then please go ahead. :) 2013/3/6 Michael Bayer mike...@zzzcomputing.com: .info on relationship is a new feature, that can be added. On Mar 5, 2013, at 7:10 PM, Xin Wang dram.w...@gmail.com wrote: Hi all, I can get info dict passed to Column() via `Model.field.info`, but with