Skip to content

Commit 3e65f75

Browse files
committed
using f-string
1 parent 0cd28f2 commit 3e65f75

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

python-sdk/src/astro/databases/base.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ def get_merge_initialization_query(parameters: tuple) -> str:
205205
it agnostic to database.
206206
"""
207207
constraints = ",".join(parameters)
208-
sql = "ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE ({})".format(constraints)
209-
return sql
208+
return f"ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE ({constraints})"
210209

211210
@staticmethod
212211
def get_table_qualified_name(table: BaseTable) -> str: # skipcq: PYL-R0201

python-sdk/src/astro/databases/duckdb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def get_merge_initialization_query(parameters: tuple) -> str:
8181
"""
8282
Handles database-specific logic to handle index for DuckDB.
8383
"""
84-
return "CREATE UNIQUE INDEX merge_index ON {{table}}({})".format(",".join(parameters))
84+
return f"CREATE UNIQUE INDEX merge_index ON {{table}}({','.join(parameters)})"
8585

8686
def merge_table(
8787
self,

python-sdk/src/astro/databases/snowflake.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,7 @@ def get_merge_initialization_query(cls, parameters: tuple) -> str:
10591059
identifier_enclosure = '"'
10601060

10611061
constraints = ",".join([f"{identifier_enclosure}{p}{identifier_enclosure}" for p in parameters])
1062-
sql = "ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE ({})".format(constraints)
1063-
return sql
1062+
return f"ALTER TABLE {{table}} ADD CONSTRAINT airflow UNIQUE ({constraints})"
10641063

10651064
def openlineage_dataset_name(self, table: BaseTable) -> str:
10661065
"""

python-sdk/src/astro/databases/sqlite.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_merge_initialization_query(parameters: tuple) -> str:
9090
"""
9191
Handles database-specific logic to handle index for Sqlite.
9292
"""
93-
return "CREATE UNIQUE INDEX merge_index ON {{table}}({})".format(",".join(parameters))
93+
return f"CREATE UNIQUE INDEX merge_index ON {{table}}({','.join(parameters)})"
9494

9595
def merge_table(
9696
self,

0 commit comments

Comments
 (0)