This is now fixed in trunk. For the moment I'm depending on SQLAlchemy trunk for the new after_attach hook until beta3 is released.

Maybe it's time to start depending on 0.5?


Brandon Craig Rhodes wrote:
I complained recently about problems with things disappearing from an
in-memory sqlite database.  It appears that my problems were actually
symptoms of something else: that, so far as I can see, doing a


when SQLAlchemy is active does *not* first do a session().commit()!
This means that the following sequence in a test suite:

   >>> p = Person(name='Brandon')
   >>> s = session()
   >>> s.add(p)
   >>> transaction.commit()

   >>> s.attribute = 'an illegal value'
   Exception: the database does not allow that attribute to have that value
   >>> transaction.rollback()

Instead, to make this work, one has to write the first stanza as:

   >>> p = Person(name='Brandon')
   >>> s = session()
   >>> s.add(p)
   >>> s.flush()  # Sheesh
   >>> transaction.commit()

Could zope.sqlalchemy be improved so that, on transaction commit, the
current SQLAlchemy session is first flushed before being committed?

Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to