Skip to content

Commit

Permalink
Merge pull request #52 Do not use set for columns in index from Lucky…
Browse files Browse the repository at this point in the history
…Sting/fix-secondary-indicies-columns-order
  • Loading branch information
rekby committed Jun 27, 2024
2 parents b16956c + 85a5d8c commit 571c373
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ydb_sqlalchemy/sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,11 @@ def visit_create_index(self, create, include_schema=False, include_table_schema=

text += " SYNC" if not ydb_opts.get("async", False) else " ASYNC"

columns = {self.preparer.format_column(col) for col in index.columns.values()}
cover_columns = {
columns = [self.preparer.format_column(col) for col in index.columns.values()]
cover_columns = [
col if isinstance(col, str) else self.preparer.format_column(col) for col in ydb_opts.get("cover", [])
}
]
cover_columns = list(dict.fromkeys(cover_columns)) # dict preserves order

text += " ON (" + ", ".join(columns) + ")"

Expand Down

0 comments on commit 571c373

Please sign in to comment.