@@ -103,7 +103,7 @@ def connect(
103103 ** kwargs ,
104104 ):
105105 self .disable_cockroachdb_telemetry = disable_cockroachdb_telemetry
106- return super (CockroachDBDialect , self ).connect (
106+ return super ().connect (
107107 dsn , connection_factory ,
108108 cursor_factory , ** kwargs )
109109
@@ -114,7 +114,7 @@ def __init__(self, *args, **kwargs):
114114 raise NotImplementedError ("server_side_cursors is not supported" )
115115 kwargs ["use_native_hstore" ] = False
116116 kwargs ["server_side_cursors" ] = False
117- super (CockroachDBDialect , self ).__init__ (* args , ** kwargs )
117+ super ().__init__ (* args , ** kwargs )
118118
119119 @classmethod
120120 def dbapi (cls ):
@@ -151,7 +151,7 @@ def initialize(self, connection):
151151 version = pkg_resources .require ("sqlalchemy-cockroachdb" )[0 ].version
152152 telemetry_query = (
153153 "SELECT crdb_internal.increment_feature_counter"
154- + "('SQLAlchemy {version}')" . format ( version = version )
154+ + f "('SQLAlchemy { version } ')"
155155 )
156156 connection .execute (text (telemetry_query ))
157157
@@ -190,7 +190,7 @@ def get_columns(self, conn, table_name, schema=None, **kw):
190190 # Oh well. Hoping 1.1 won't be around for long.
191191 rows = conn .execute (
192192 text (
193- 'SHOW COLUMNS FROM "%s"."%s"' % ( schema or self .default_schema_name , table_name )
193+ f 'SHOW COLUMNS FROM "{ schema or self .default_schema_name } "." { table_name } "'
194194 )
195195 )
196196 elif not self ._is_v191plus :
@@ -234,7 +234,7 @@ def get_columns(self, conn, table_name, schema=None, **kw):
234234 try :
235235 type_class = _type_map [type_name .lower ()]
236236 except KeyError :
237- warn ("Did not recognize type '%s ' of column '%s'" % ( type_name , name ) )
237+ warn (f "Did not recognize type '{ type_name } ' of column '{ name } '" )
238238 type_class = sqltypes .NULLTYPE
239239 if type_args :
240240 typ = type_class (* [int (s .strip ()) for s in type_args .split ("," )])
@@ -350,7 +350,7 @@ def get_foreign_keys_v1(self, conn, table_name, schema=None, **kw):
350350
351351 for row in conn .execute (
352352 text (
353- 'SHOW CONSTRAINTS FROM "%s"."%s"' % ( schema or self .default_schema_name , table_name )
353+ f 'SHOW CONSTRAINTS FROM "{ schema or self .default_schema_name } "." { table_name } "'
354354 )
355355 ):
356356 if row .Type .startswith ("FOREIGN KEY" ):
@@ -483,7 +483,7 @@ def get_foreign_keys(
483483
484484 def get_pk_constraint (self , conn , table_name , schema = None , ** kw ):
485485 if self ._is_v21plus :
486- return super (CockroachDBDialect , self ).get_pk_constraint (conn , table_name , schema , ** kw )
486+ return super ().get_pk_constraint (conn , table_name , schema , ** kw )
487487
488488 # v2.0 does not know about enough SQL to understand the query done by
489489 # the upstream dialect. So run a dumbed down version instead.
@@ -505,7 +505,7 @@ def get_pk_constraint(self, conn, table_name, schema=None, **kw):
505505
506506 def get_unique_constraints (self , conn , table_name , schema = None , ** kw ):
507507 if self ._is_v21plus :
508- return super (CockroachDBDialect , self ).get_unique_constraints (
508+ return super ().get_unique_constraints (
509509 conn , table_name , schema , ** kw
510510 )
511511
@@ -525,7 +525,7 @@ def get_unique_constraints(self, conn, table_name, schema=None, **kw):
525525
526526 def get_check_constraints (self , conn , table_name , schema = None , ** kw ):
527527 if self ._is_v21plus :
528- return super (CockroachDBDialect , self ).get_check_constraints (
528+ return super ().get_check_constraints (
529529 conn , table_name , schema , ** kw
530530 )
531531 # TODO(bdarnell): The postgres dialect implementation depends on
@@ -538,21 +538,21 @@ def do_savepoint(self, connection, name):
538538 if savepoint_state .cockroach_restart :
539539 connection .execute (text ("SAVEPOINT cockroach_restart" ))
540540 else :
541- super (CockroachDBDialect , self ).do_savepoint (connection , name )
541+ super ().do_savepoint (connection , name )
542542
543543 def do_rollback_to_savepoint (self , connection , name ):
544544 # Savepoint logic customized to work with run_transaction().
545545 if savepoint_state .cockroach_restart :
546546 connection .execute (text ("ROLLBACK TO SAVEPOINT cockroach_restart" ))
547547 else :
548- super (CockroachDBDialect , self ).do_rollback_to_savepoint (connection , name )
548+ super ().do_rollback_to_savepoint (connection , name )
549549
550550 def do_release_savepoint (self , connection , name ):
551551 # Savepoint logic customized to work with run_transaction().
552552 if savepoint_state .cockroach_restart :
553553 connection .execute (text ("RELEASE SAVEPOINT cockroach_restart" ))
554554 else :
555- super (CockroachDBDialect , self ).do_release_savepoint (connection , name )
555+ super ().do_release_savepoint (connection , name )
556556
557557
558558# If alembic is installed, register an alias in its dialect mapping.
0 commit comments