Skip to content

Commit

Permalink
Account for renamed index columns.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlipperPA committed Jan 14, 2025
1 parent c9d30dc commit 192aa7a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions automagic_rest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit 192aa7a

Please # to comment.