Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pre-commit: UP031 Use format specifiers instead of percent format #2155

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions python-sdk/src/astro/databases/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ def get_merge_initialization_query(parameters: tuple) -> str:
it agnostic to database.
"""
constraints = ",".join(parameters)
sql = "ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE (%s)" % constraints
return sql
return f"ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE ({constraints})"

@staticmethod
def get_table_qualified_name(table: BaseTable) -> str: # skipcq: PYL-R0201
Expand Down
2 changes: 1 addition & 1 deletion python-sdk/src/astro/databases/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_merge_initialization_query(parameters: tuple) -> str:
"""
Handles database-specific logic to handle index for DuckDB.
"""
return "CREATE UNIQUE INDEX merge_index ON {{table}}(%s)" % ",".join(parameters) # skipcq PYL-C0209
return f"CREATE UNIQUE INDEX merge_index ON {{table}}({','.join(parameters)})"

def merge_table(
self,
Expand Down
3 changes: 1 addition & 2 deletions python-sdk/src/astro/databases/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,7 @@ def get_merge_initialization_query(cls, parameters: tuple) -> str:
identifier_enclosure = '"'

constraints = ",".join([f"{identifier_enclosure}{p}{identifier_enclosure}" for p in parameters])
sql = "ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE (%s)" % constraints # skipcq PYL-C0209
return sql
return f"ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE ({constraints})"

def openlineage_dataset_name(self, table: BaseTable) -> str:
"""
Expand Down
2 changes: 1 addition & 1 deletion python-sdk/src/astro/databases/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_merge_initialization_query(parameters: tuple) -> str:
"""
Handles database-specific logic to handle index for Sqlite.
"""
return "CREATE UNIQUE INDEX merge_index ON {{table}}(%s)" % ",".join(parameters) # skipcq PYL-C0209
return f"CREATE UNIQUE INDEX merge_index ON {{table}}({','.join(parameters)})"

def merge_table(
self,
Expand Down
Loading