1. Michael Bayer
  2. sqlalchemy
  3. Issues


Issue #3167 resolved

Key updating after insert is triggering validations

Mario Benito Ríos
created an issue

With MySQL backend, on commit after creating a new object with "autoincrement" PK, key updating is triggering validator. See https://bitbucket.org/zzzeek/sqlalchemy/src/2de7f94739ec1873e1dce48797e1e6f12044cf4c/lib/sqlalchemy/orm/persistence.py?at=master#cl-650

Documentation says only user assignments trigger validations, so this case shouldn't trigger validation.

Comments (4)

  1. Michael Bayer repo owner
    • Fixed bug where attribute "set" events or columns with @validates would have events triggered within the flush process, when those columns were the targets of a "fetch and populate" operation, such as an autoincremented primary key, a Python side default, or a server-side default "eagerly" fetched via RETURNING. fixes #3167

    → <<cset 530d3f07e0c1>>

  2. Log in to comment