Skip to content

Commit

Permalink
using f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajastro committed May 16, 2024
1 parent 0cd28f2 commit 3e65f75
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
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 ({})".format(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}}({})".format(",".join(parameters))
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 ({})".format(constraints)
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}}({})".format(",".join(parameters))
return f"CREATE UNIQUE INDEX merge_index ON {{table}}({','.join(parameters)})"

def merge_table(
self,
Expand Down

0 comments on commit 3e65f75

Please sign in to comment.