Handle DedupedColumnCollection in db_indexes

This should fix the `scripts/check_model.py` script and the database
indexes github workflow.

Accessing index columns has changed: index.columns gives access to a
DedupedColumnCollection instead of a ColumnCollection.
Columns can be accessed by key; keys are accessed via keys() attr.

Ref:
https://docs.sqlalchemy.org/en/14/changelog/migration_14.html#select-objects-and-derived-from-clauses-allow-for-duplicate-columns-and-column-labels
https://docs.sqlalchemy.org/en/14/core/sqlelement.html?highlight=dedupecolumncollection#sqlalchemy.sql.expression.ColumnCollection
This commit is contained in:
Sergey Golitsynskiy
2021-05-18 19:00:55 -04:00
parent fa20de7692
commit 3cd1c7f1c7
+1 -1
View File
@@ -19,7 +19,7 @@ IndexTuple = namedtuple('IndexTuple', 'table column_names')
def tuple_from_index(index):
columns = tuple([getattr(index.columns, c).name for c in dir(index.columns) if not c.startswith('__')])
columns = tuple([index.columns[key].name for key in index.columns.keys()])
if len(columns) == 1:
columns = columns[0]
return IndexTuple(index.table.name, columns)