state change of insert() construct when column-level generator is used

Issue #3603 resolved
Mike Bayer repo owner created an issue

stack trace for reserved bind names only on the second go, meaning the insert() has changed state upon compile():

import sqlalchemy as sa

meta = sa.MetaData()
table = sa.Table('mytable', meta,
    sa.Column('foo', sa.String),
    sa.Column('bar', sa.String, default='baz'),
)

select = sa.select([table.c.foo])
insert = table.insert().from_select(['foo'], select)

print insert.compile()
print insert.compile()

Comments (2)

  1. Mike Bayer reporter
    • Fixed issue within the :meth:.Insert.from_select construct whereby the :class:.Select construct would have its ._raw_columns collection mutated in-place when compiling the :class:.Insert construct, when the target :class:.Table has Python-side defaults. The :class:.Select construct would compile standalone with the erroneous column present subsequent to compilation of the :class:.Insert, and the the :class:.Insert statement itself would fail on a second compile attempt due to duplicate bound parameters. fixes #3603

    → <<cset e57bf7961692>>

  2. Mike Bayer reporter
    • Fixed issue within the :meth:.Insert.from_select construct whereby the :class:.Select construct would have its ._raw_columns collection mutated in-place when compiling the :class:.Insert construct, when the target :class:.Table has Python-side defaults. The :class:.Select construct would compile standalone with the erroneous column present subsequent to compilation of the :class:.Insert, and the the :class:.Insert statement itself would fail on a second compile attempt due to duplicate bound parameters. fixes #3603

    (cherry picked from commit e57bf796169282f69187f50665f5ea233c2c9ab7)

    → <<cset 6d44b0126301>>

  3. Log in to comment