1818
1919# pylint: disable=invalid-name,missing-function-docstring
2020def calculate_destination_stream_name (stream , md_map ):
21- return "{}-{}" . format ( md_map .get ((), {}).get ('schema-name' ), stream ['stream' ])
21+ return f" { md_map .get ((), {}).get ('schema-name' )} - { stream ['stream' ]} "
2222
2323
2424# from the postgres docs:
@@ -29,13 +29,11 @@ def canonicalize_identifier(identifier):
2929
3030
3131def fully_qualified_column_name (schema , table , column ):
32- return '"{}"."{}"."{}"' .format (canonicalize_identifier (schema ),
33- canonicalize_identifier (table ),
34- canonicalize_identifier (column ))
32+ return f'"{ canonicalize_identifier (schema )} "."{ canonicalize_identifier (table )} "."{ canonicalize_identifier (column )} "'
3533
3634
3735def fully_qualified_table_name (schema , table ):
38- return '"{}"."{}"' . format ( canonicalize_identifier (schema ), canonicalize_identifier ( table ))
36+ return f '"{ canonicalize_identifier ( schema ) } "."{ canonicalize_identifier (table )} "'
3937
4038
4139def open_connection (conn_config , logical_replication = False ):
@@ -60,7 +58,7 @@ def open_connection(conn_config, logical_replication=False):
6058 return conn
6159
6260def prepare_columns_for_select_sql (c , md_map ):
63- column_name = ' "{}" ' . format ( canonicalize_identifier (c ))
61+ column_name = f ' "{ canonicalize_identifier (c )} " '
6462
6563 if ('properties' , c ) in md_map :
6664 sql_datatype = md_map [('properties' , c )]['sql-datatype' ]
@@ -73,17 +71,17 @@ def prepare_columns_for_select_sql(c, md_map):
7371 return column_name
7472
7573def prepare_columns_sql (c ):
76- column_name = """ "{}" """ . format ( canonicalize_identifier ( c ))
74+ column_name = f """ "{ canonicalize_identifier ( c ) } " """
7775 return column_name
7876
7977
8078def filter_dbs_sql_clause (sql , filter_dbs ):
81- in_clause = " AND datname in (" + "," .join (["'{}'" . format ( b .strip (' ' )) for b in filter_dbs .split (',' )]) + ")"
79+ in_clause = " AND datname in (" + "," .join ([f "'{ b .strip (' ' )} '" for b in filter_dbs .split (',' )]) + ")"
8280 return sql + in_clause
8381
8482
8583def filter_schemas_sql_clause (sql , filer_schemas ):
86- in_clause = " AND n.nspname in (" + "," .join (["'{}'" . format ( b .strip (' ' )) for b in filer_schemas .split (',' )]) + ")"
84+ in_clause = " AND n.nspname in (" + "," .join ([f "'{ b .strip (' ' )} '" for b in filer_schemas .split (',' )]) + ")"
8785 return sql + in_clause
8886
8987
@@ -152,11 +150,10 @@ def selected_value_to_singer_value_impl(elem, sql_datatype):
152150 if sql_datatype == 'hstore' :
153151 cleaned_elem = elem
154152 else :
155- raise Exception ("do not know how to marshall a dict if its not an hstore or json: {}" . format ( sql_datatype ) )
153+ raise Exception (f "do not know how to marshall a dict if its not an hstore or json: { sql_datatype } " )
156154 else :
157155 raise Exception (
158- "do not know how to marshall value of class( {} ) and sql_datatype ( {} )" .format (elem .__class__ ,
159- sql_datatype ))
156+ f"do not know how to marshall value of class( { elem .__class__ } ) and sql_datatype ( { sql_datatype } )" )
160157
161158 return cleaned_elem
162159
@@ -249,7 +246,7 @@ def numeric_min(precision, scale):
249246
250247
251248def filter_tables_sql_clause (sql , tables : List [str ]):
252- in_clause = " AND pg_class.relname in (" + "," .join (["'{}'" . format ( b .strip (' ' )) for b in tables ]) + ")"
249+ in_clause = " AND pg_class.relname in (" + "," .join ([f "'{ b .strip (' ' )} '" for b in tables ]) + ")"
253250 return sql + in_clause
254251
255252def get_database_name (connection ):
0 commit comments