From 3cd1c7f1c768b8c68cf56d0fab7ea7967a4ea3db Mon Sep 17 00:00:00 2001 From: Sergey Golitsynskiy Date: Mon, 5 Apr 2021 21:14:09 -0400 Subject: [PATCH] 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 --- scripts/check_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_model.py b/scripts/check_model.py index 65e6d7cb4f4..e4f093bdc7d 100644 --- a/scripts/check_model.py +++ b/scripts/check_model.py @@ -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)