]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commit
fix metadata requirement in fk render; remove column.copy()
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 8 Jul 2025 14:05:56 +0000 (10:05 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 8 Jul 2025 14:05:56 +0000 (10:05 -0400)
commit7c84327e2c02b1fe7f8336d63dc7c8a89b609870
treec5a8207a1ca20b1dbf9a023c4d11967ec3a7645d
parent0505047601a53060144161d79249d1451b9f4e2b
fix metadata requirement in fk render; remove column.copy()

Fixed autogenerate rendering bug which failed to render foreign key
constraints local to a :class:`.CreateTableOp` object if it did not refer
to a ``MetaData`` collection via a private constructor argument that would
not ordinarily be passed in user-defined rewriter recipes, including ones
in the Alembic cookbook section of the docs.

Also removed the use of column.copy() from the CreateTableOp rewriter
recipe and added a new test for this recipe which includes a table with
an FK.  it's not clear why copy() was needed here and if we get more
reports of issues, we can add to this test suite and adjust.

Fixes: #1692
Change-Id: I6cf6c8f62b7eb116cfc78216b3dbcbddad499691
alembic/autogenerate/render.py
docs/build/cookbook.rst
docs/build/unreleased/1692.rst [new file with mode: 0644]
tests/test_autogen_render.py
tests/test_script_production.py