From 192aa7a35addc22376c5f889d86f1a25bbfec4e1 Mon Sep 17 00:00:00 2001 From: "Allen, Timothy" Date: Tue, 14 Jan 2025 17:29:20 -0500 Subject: [PATCH] Account for renamed index columns. --- automagic_rest/views.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/automagic_rest/views.py b/automagic_rest/views.py index f762db0..334bbc6 100644 --- a/automagic_rest/views.py +++ b/automagic_rest/views.py @@ -233,19 +233,18 @@ def get_indexes(self): by providing schema name and table name. """ - cursor = connections[self.db_name].cursor() + index_columns = [] + cursor = connections[self.db_name].cursor() cursor.execute( self.index_sql, {"schema_name": self.schema_name, "table_name": self.table_name}, ) - rows = cursor.fetchall() - index_columns = [] - for row in rows: - index_columns.append(row[0]) + column_name, _ = reserved_word_check(row[0]) + index_columns.append(column_name) return index_columns @@ -269,7 +268,6 @@ def get_positions(self): for row in cursor.fetchall(): column_name, _ = reserved_word_check(row[0]) - - positions[column_name] = row[1] + positions[column_name] = row[1] return positions