]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Fully copy index expressions
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Dec 2017 18:58:58 +0000 (13:58 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Dec 2017 18:58:58 +0000 (13:58 -0500)
commit31dd4824d33572b708abd331b3271a298d14966c
tree505e0a10a5d5778c31ab3035c98a18a680d0398b
parent04937652f426e518781b2b762b0e0e8090857cbd
Fully copy index expressions

Fixed bug where the :meth:`.Table.tometadata` method would not properly
accommodate :class:`.Index` objects that didn't consist of simple
column expressions, such as indexes against a :func:`.text` construct,
indexes that used SQL expressions or :attr:`.func`, etc.   The routine
now copies expressions fully to a new :class:`.Index` object while
substituting all table-bound :class:`.Column` objects for those
of the target table.

Also refined the means by which tometadata() checks if an Index
or UniqueConstraint is generated by a column-level flag, by propagating
an attribute "_column_flag=True" to such indexes/constraints.

Change-Id: I7ef1b8ea42f9933357ae35f241a5ba9838bac35b
Fixes: #4147
doc/build/changelog/unreleased_12/4147.rst [new file with mode: 0644]
lib/sqlalchemy/sql/schema.py
test/sql/test_metadata.py