the most idiomatic way to handle this is to merge the objects in:
obj = session.merge(existing_object)
this will emit a SELECT for the existing row, then copy the state of
existing_object to an object located for that primary key, if found.
It ensures that the correct choice of
On Thursday, September 27, 2012 9:21:57 AM UTC-4, Shawn Wheatley wrote:
the most idiomatic way to handle this is to merge the objects in:
obj = session.merge(existing_object)
this will emit a SELECT for the existing row, then copy the state of
existing_object to an object located
session.merge only looks at the primary key of the instance you are
inserting (it pays no attention to unique constraints). In your
example, the table contains a single row with PK (1, 1), and you are
merging an instance with PK (1, 4). SA sees these as different, so it
tries to INSERT
On Thursday, September 27, 2012 1:06:14 PM UTC-4, Shawn Wheatley wrote:
session.merge only looks at the primary key of the instance you are
inserting (it pays no attention to unique constraints). In your
example, the table contains a single row with PK (1, 1), and you are
merging an instance
Fantastic, that event hack was just what I needed. I did have to change
sub to replace on the statement, for any future readers, but that was a
trivial change. Thanks Michael!
Shawn
On Wednesday, June 6, 2012 3:51:55 PM UTC-4, Shawn Wheatley wrote:
Hi,
I'm trying to use my declarative
Hi,
I'm trying to use my declarative models to copy data from an Oracle
database with a non-default schema name to a SQLite database (which has no
schema name, or at least a default name that can't be changed). Copying
from Oracle to Oracle has not been a problem for me, but Oracle to SQLite