[sqlalchemy] polymorphic: modification of a column on child doesn't update parent's columns marked onupdate

2013-11-08 Thread Bertrand Mathieu
Hi, I have a set up class inheritance using joined table inheritance. I'm using sqlalchemy 0.8.2. The Parent class has a DateTime attribute updated_at, with onupdate=datetime.utcnow. If I update only one of the Child's attributes, only child table is updated, parent.updated_at is not

Re: [sqlalchemy] polymorphic: modification of a column on child doesn't update parent's columns marked onupdate

2013-11-08 Thread Richard Gerd Kuesters
I think the code is correct and is behaving correctly also -- since you update just the child, the parent isn't touched (it already has data and was not changed in this session). What you could do is add an update event to your Child object: *def update_child(mapper, connection, target):**

Re: [sqlalchemy] polymorphic: modification of a column on child doesn't update parent's columns marked onupdate

2013-11-08 Thread Bertrand Mathieu
Hello, Thank you for your answer, but unless I miss something in your answer my problem has to do with polymorphic inheritance, it's not about relationship between 2 models. By inheritance updated_at is an attribute of any Child instance ( Child().updated_at exists). I realize I didn't

Re: [sqlalchemy] polymorphic: modification of a column on child doesn't update parent's columns marked onupdate

2013-11-08 Thread Richard Gerd Kuesters
Yup, I understood your question :) Let me see if I can be a little more specific. Even with inheritance and polymorphism, you still have two tables (entity and child) in the database. If you update just the value in the Child instance (which exists just in the child table), the entity table

Re: [sqlalchemy] polymorphic: modification of a column on child doesn't update parent's columns marked onupdate

2013-11-08 Thread Bertrand Mathieu
I followed the flush process and I think for now it's hard to trick the persistence to make it thinks it has to emit an update statement for entity table, only for columns having an onupdate attribute (and a value computed from this definition). So I can only make an ad-hoc workaround in

Re: [sqlalchemy] Multi-Level inheritance and history_meta versioning issue

2013-11-08 Thread JPLaverdure
Hi Michael, Thanks for your response. Is release 0.9 stable enough to use in a production env ? When you mention that it isn't supported I'm a bit surprised/confused.. As such, the inheritance scheme has worked fine using 0.8 as long as I wan't dipping in the history of the objects.

Re: [sqlalchemy] polymorphic: modification of a column on child doesn't update parent's columns marked onupdate

2013-11-08 Thread Richard Gerd Kuesters
Well, in the case you put updated_at field in child, you can make a relationship or backref ordered by updated_at column desc, and picking up just one value as scalar :) Some implementations that have this kind of particularity also have value_last_updated_at to do the job :) Cheers,

Re: [sqlalchemy] Multi-Level inheritance and history_meta versioning issue

2013-11-08 Thread JPLaverdure
Hey Michael, Tried out the new version and the _history now functions as it should :) Many thanks ! Also: over time, I had added an extra field to the _history tables corresponding to the modification datetime (as a timestamp), along with an extra param in the table creation call to support

Re: [sqlalchemy] Multi-Level inheritance and history_meta versioning issue

2013-11-08 Thread Michael Bayer
On Nov 8, 2013, at 9:52 AM, JPLaverdure jp.laverd...@gmail.com wrote: Hi Michael, Thanks for your response. Is release 0.9 stable enough to use in a production env ? it is for me, I’ve called it “beta” to give people a heads up but we’ve really gotten almost no regression/bug reports,

[sqlalchemy] Connecting via pyodbc (to Vertica)

2013-11-08 Thread Yang Zhang
I'm trying to connect to Vertica as a regular ODBC DSN, which I can do fine outside of sqlalchemy: $ isql -v pod +---+ | Connected!| | | | sql-statement | | help

[sqlalchemy] Re: Connecting via pyodbc (to Vertica)

2013-11-08 Thread Yang Zhang
Right after sending this, I hit upon the magic incantation, which I had not thought of trying: vertica+pyodbc://pod Sigh. On Fri, Nov 8, 2013 at 4:48 PM, Yang Zhang yanghates...@gmail.com wrote: I'm trying to connect to Vertica as a regular ODBC DSN, which I can do fine outside of sqlalchemy: