Re: [Sqlalchemy-tickets] [sqlalchemy] #2809: Strange effect with association proxy and event listen
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-08-29 11:54:44
|
#2809: Strange effect with association proxy and event listener
-----------------------------------+------------------------------------
Reporter: schlamar | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: (none) | Severity: no triage selected yet
Resolution: invalid | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Changes (by zzzeek):
* status: reopened => closed
* resolution: => invalid
Comment:
OK, please, please, can we go to the mailing list. this is not a bug.
You are calling flush() in the middle of an event which is occurring
before your object is ready to be flushed. if you remove the event
handler you're adding, there's no stack trace - you've essentially
illustrated with flush() what is already happening in your real app due to
autoflush (note the original stack trace has _autoflush() vs. this one
which has flush()), and I've already explained, if you have a block that
can't be autoflushed, please use the "no_autoflush" helper, that's what
it's for.
Of course if you tell the session to flush() at the point at which your
objects are not completely associated with each other such that you'll get
integrity violations due to null constraints, you'll get an integrity
violation. SQLAlchemy can't magically undo what you're telling it to do
in order to avoid an exception.
Lets talk about where/how you can temporarily turn off autoflush on the
mailing list, it's here: http://groups.google.com/group/sqlalchemy/
(though I'm off the grid for the next couple of days).
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2809#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|