From be705595846cd2205c72f9d87c025f8dc530cb73 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 5 Nov 2018 14:52:35 -0500 Subject: 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 --- lib/sqlalchemy/dialects/sqlite/base.py | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'lib/sqlalchemy/dialects/sqlite/base.py') diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py index 345ad901e..cef6756b2 100644 --- a/lib/sqlalchemy/dialects/sqlite/base.py +++ b/lib/sqlalchemy/dialects/sqlite/base.py @@ -1020,19 +1020,6 @@ class SQLiteIdentifierPreparer(compiler.IdentifierPreparer): 'when', 'where', ]) - def format_index(self, index, use_schema=True, name=None): - """Prepare a quoted index and schema name.""" - - if name is None: - name = index.name - result = self.quote(name, index.quote) - if (not self.omit_schema and - use_schema and - getattr(index.table, "schema", None)): - result = self.quote_schema( - index.table.schema, index.table.quote_schema) + "." + result - return result - class SQLiteExecutionContext(default.DefaultExecutionContext): @util.memoized_property -- cgit v1.2.1