]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Add new "all columns" naming convention tokens
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 5 Nov 2018 19:52:35 +0000 (14:52 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 10 Nov 2018 21:13:01 +0000 (16:13 -0500)
commitbe705595846cd2205c72f9d87c025f8dc530cb73
treed690bf7efe8c7d9e8b52472aa9b8db6a1b8e75e7
parent15ac07f7b6c235131361f289d75d174c49afb0b5
Add new "all columns" naming convention tokens

Added new naming convention tokens ``column_0N_name``, ``column_0_N_name``,
etc., which will render the names / keys / labels for all columns referenced
by a particular constraint in a sequence.  In order to accommodate for the
length of such a naming convention, the SQL compiler's auto-truncation
feature now applies itself to constraint names as well, which creates a
shortened, deterministically generated name for the constraint that will
apply to a target backend without going over the character limit of that
backend.

Additional notes:

1. the SQLite dialect had a format_index method that was apparently not
used, removed.

2. the naming convention logic has been applying the foreign key
remote column spec to the naming convention, and not the actual
column name.  In the case where the referenced Table object uses
.key inside the columns and these are what ForeignKey() references,
the naming convention was doing the wrong thing.   The patch here
fixes this, however this isn't noted in the migration notes.

Fixes: #3989
Change-Id: Ib24f4754b886676096c480fc54b2e5c2463ac99a
doc/build/changelog/migration_13.rst
doc/build/changelog/unreleased_13/3989.rst [new file with mode: 0644]
doc/build/core/constraints.rst
lib/sqlalchemy/dialects/sqlite/base.py
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/naming.py
lib/sqlalchemy/sql/schema.py
test/sql/test_metadata.py