Thanks for the explanation, Mike. That makes sense and now I know about
this behaviour.
> you can get your test program to succeed by sending name=None for the
second B():
I realize my example was pretty trivial, but suppose in a real-world
example where table B did not simply have the column
the names of attributes on your Python class and the names of columns that are
emitted in SQL are two separate things.When you have "jobid =
Column(Integer, ...)" , that's a declarative-only format that omits the first
argument to Column which is the "name"; the declarative mapping process
this is the long-expected behavior of the unit of work when issuing a delete()
and then an add() of two different objects that nonetheless have the same
primary key value - instead of DELETE and INSERT, you get an UPDATE. the
reasons have to do with the unit-of-work's ordering of
I normally define a column in a model like this, for example:
jobID = Column(Integer, nullable=False, primary_key=True)
I now have a case where there are columns in the db that have spaces
so I want to map the column name to a variable of a different name.
Googling I found this: