summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2022-11-03 20:52:21 +0100
committerFederico Caselli <cfederico87@gmail.com>2022-11-16 23:03:04 +0100
commit4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66 (patch)
tree4970cff3f78489a4a0066cd27fd4bae682402957 /lib/sqlalchemy/dialects
parent3fc6c40ea77c971d3067dab0fdf57a5b5313b69b (diff)
downloadsqlalchemy-4eb4ceca36c7ce931ea65ac06d6ed08bf459fc66.tar.gz
Try running pyupgrade on the code
command run is "pyupgrade --py37-plus --keep-runtime-typing --keep-percent-format <files...>" pyupgrade will change assert_ to assertTrue. That was reverted since assertTrue does not exists in sqlalchemy fixtures Change-Id: Ie1ed2675c7b11d893d78e028aad0d1576baebb55
Diffstat (limited to 'lib/sqlalchemy/dialects')
-rw-r--r--lib/sqlalchemy/dialects/mssql/base.py450
-rw-r--r--lib/sqlalchemy/dialects/mssql/pymssql.py6
-rw-r--r--lib/sqlalchemy/dialects/mssql/pyodbc.py24
-rw-r--r--lib/sqlalchemy/dialects/mysql/aiomysql.py6
-rw-r--r--lib/sqlalchemy/dialects/mysql/asyncmy.py6
-rw-r--r--lib/sqlalchemy/dialects/mysql/base.py22
-rw-r--r--lib/sqlalchemy/dialects/mysql/enumerated.py14
-rw-r--r--lib/sqlalchemy/dialects/mysql/expression.py4
-rw-r--r--lib/sqlalchemy/dialects/mysql/mariadbconnector.py10
-rw-r--r--lib/sqlalchemy/dialects/mysql/mysqlconnector.py20
-rw-r--r--lib/sqlalchemy/dialects/mysql/mysqldb.py12
-rw-r--r--lib/sqlalchemy/dialects/mysql/pymysql.py6
-rw-r--r--lib/sqlalchemy/dialects/mysql/pyodbc.py2
-rw-r--r--lib/sqlalchemy/dialects/mysql/reflection.py4
-rw-r--r--lib/sqlalchemy/dialects/mysql/types.py52
-rw-r--r--lib/sqlalchemy/dialects/oracle/base.py18
-rw-r--r--lib/sqlalchemy/dialects/oracle/cx_oracle.py4
-rw-r--r--lib/sqlalchemy/dialects/oracle/types.py6
-rw-r--r--lib/sqlalchemy/dialects/postgresql/_psycopg_common.py6
-rw-r--r--lib/sqlalchemy/dialects/postgresql/array.py2
-rw-r--r--lib/sqlalchemy/dialects/postgresql/asyncpg.py8
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py228
-rw-r--r--lib/sqlalchemy/dialects/postgresql/dml.py2
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ext.py2
-rw-r--r--lib/sqlalchemy/dialects/postgresql/json.py2
-rw-r--r--lib/sqlalchemy/dialects/postgresql/named_types.py4
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2.py2
-rw-r--r--lib/sqlalchemy/dialects/postgresql/types.py4
-rw-r--r--lib/sqlalchemy/dialects/sqlite/base.py297
-rw-r--r--lib/sqlalchemy/dialects/sqlite/dml.py2
-rw-r--r--lib/sqlalchemy/dialects/sqlite/pysqlcipher.py8
-rw-r--r--lib/sqlalchemy/dialects/sqlite/pysqlite.py4
32 files changed, 574 insertions, 663 deletions
diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py
index 53fe96c9a..a0049c361 100644
--- a/lib/sqlalchemy/dialects/mssql/base.py
+++ b/lib/sqlalchemy/dialects/mssql/base.py
@@ -965,190 +965,188 @@ MS_2008_VERSION = (10,)
MS_2005_VERSION = (9,)
MS_2000_VERSION = (8,)
-RESERVED_WORDS = set(
- [
- "add",
- "all",
- "alter",
- "and",
- "any",
- "as",
- "asc",
- "authorization",
- "backup",
- "begin",
- "between",
- "break",
- "browse",
- "bulk",
- "by",
- "cascade",
- "case",
- "check",
- "checkpoint",
- "close",
- "clustered",
- "coalesce",
- "collate",
- "column",
- "commit",
- "compute",
- "constraint",
- "contains",
- "containstable",
- "continue",
- "convert",
- "create",
- "cross",
- "current",
- "current_date",
- "current_time",
- "current_timestamp",
- "current_user",
- "cursor",
- "database",
- "dbcc",
- "deallocate",
- "declare",
- "default",
- "delete",
- "deny",
- "desc",
- "disk",
- "distinct",
- "distributed",
- "double",
- "drop",
- "dump",
- "else",
- "end",
- "errlvl",
- "escape",
- "except",
- "exec",
- "execute",
- "exists",
- "exit",
- "external",
- "fetch",
- "file",
- "fillfactor",
- "for",
- "foreign",
- "freetext",
- "freetexttable",
- "from",
- "full",
- "function",
- "goto",
- "grant",
- "group",
- "having",
- "holdlock",
- "identity",
- "identity_insert",
- "identitycol",
- "if",
- "in",
- "index",
- "inner",
- "insert",
- "intersect",
- "into",
- "is",
- "join",
- "key",
- "kill",
- "left",
- "like",
- "lineno",
- "load",
- "merge",
- "national",
- "nocheck",
- "nonclustered",
- "not",
- "null",
- "nullif",
- "of",
- "off",
- "offsets",
- "on",
- "open",
- "opendatasource",
- "openquery",
- "openrowset",
- "openxml",
- "option",
- "or",
- "order",
- "outer",
- "over",
- "percent",
- "pivot",
- "plan",
- "precision",
- "primary",
- "print",
- "proc",
- "procedure",
- "public",
- "raiserror",
- "read",
- "readtext",
- "reconfigure",
- "references",
- "replication",
- "restore",
- "restrict",
- "return",
- "revert",
- "revoke",
- "right",
- "rollback",
- "rowcount",
- "rowguidcol",
- "rule",
- "save",
- "schema",
- "securityaudit",
- "select",
- "session_user",
- "set",
- "setuser",
- "shutdown",
- "some",
- "statistics",
- "system_user",
- "table",
- "tablesample",
- "textsize",
- "then",
- "to",
- "top",
- "tran",
- "transaction",
- "trigger",
- "truncate",
- "tsequal",
- "union",
- "unique",
- "unpivot",
- "update",
- "updatetext",
- "use",
- "user",
- "values",
- "varying",
- "view",
- "waitfor",
- "when",
- "where",
- "while",
- "with",
- "writetext",
- ]
-)
+RESERVED_WORDS = {
+ "add",
+ "all",
+ "alter",
+ "and",
+ "any",
+ "as",
+ "asc",
+ "authorization",
+ "backup",
+ "begin",
+ "between",
+ "break",
+ "browse",
+ "bulk",
+ "by",
+ "cascade",
+ "case",
+ "check",
+ "checkpoint",
+ "close",
+ "clustered",
+ "coalesce",
+ "collate",
+ "column",
+ "commit",
+ "compute",
+ "constraint",
+ "contains",
+ "containstable",
+ "continue",
+ "convert",
+ "create",
+ "cross",
+ "current",
+ "current_date",
+ "current_time",
+ "current_timestamp",
+ "current_user",
+ "cursor",
+ "database",
+ "dbcc",
+ "deallocate",
+ "declare",
+ "default",
+ "delete",
+ "deny",
+ "desc",
+ "disk",
+ "distinct",
+ "distributed",
+ "double",
+ "drop",
+ "dump",
+ "else",
+ "end",
+ "errlvl",
+ "escape",
+ "except",
+ "exec",
+ "execute",
+ "exists",
+ "exit",
+ "external",
+ "fetch",
+ "file",
+ "fillfactor",
+ "for",
+ "foreign",
+ "freetext",
+ "freetexttable",
+ "from",
+ "full",
+ "function",
+ "goto",
+ "grant",
+ "group",
+ "having",
+ "holdlock",
+ "identity",
+ "identity_insert",
+ "identitycol",
+ "if",
+ "in",
+ "index",
+ "inner",
+ "insert",
+ "intersect",
+ "into",
+ "is",
+ "join",
+ "key",
+ "kill",
+ "left",
+ "like",
+ "lineno",
+ "load",
+ "merge",
+ "national",
+ "nocheck",
+ "nonclustered",
+ "not",
+ "null",
+ "nullif",
+ "of",
+ "off",
+ "offsets",
+ "on",
+ "open",
+ "opendatasource",
+ "openquery",
+ "openrowset",
+ "openxml",
+ "option",
+ "or",
+ "order",
+ "outer",
+ "over",
+ "percent",
+ "pivot",
+ "plan",
+ "precision",
+ "primary",
+ "print",
+ "proc",
+ "procedure",
+ "public",
+ "raiserror",
+ "read",
+ "readtext",
+ "reconfigure",
+ "references",
+ "replication",
+ "restore",
+ "restrict",
+ "return",
+ "revert",
+ "revoke",
+ "right",
+ "rollback",
+ "rowcount",
+ "rowguidcol",
+ "rule",
+ "save",
+ "schema",
+ "securityaudit",
+ "select",
+ "session_user",
+ "set",
+ "setuser",
+ "shutdown",
+ "some",
+ "statistics",
+ "system_user",
+ "table",
+ "tablesample",
+ "textsize",
+ "then",
+ "to",
+ "top",
+ "tran",
+ "transaction",
+ "trigger",
+ "truncate",
+ "tsequal",
+ "union",
+ "unique",
+ "unpivot",
+ "update",
+ "updatetext",
+ "use",
+ "user",
+ "values",
+ "varying",
+ "view",
+ "waitfor",
+ "when",
+ "where",
+ "while",
+ "with",
+ "writetext",
+}
class REAL(sqltypes.REAL):
@@ -1159,7 +1157,7 @@ class REAL(sqltypes.REAL):
# it is only accepted as the word "REAL" in DDL, the numeric
# precision value is not allowed to be present
kw.setdefault("precision", 24)
- super(REAL, self).__init__(**kw)
+ super().__init__(**kw)
class TINYINT(sqltypes.Integer):
@@ -1204,7 +1202,7 @@ class _MSDate(sqltypes.Date):
class TIME(sqltypes.TIME):
def __init__(self, precision=None, **kwargs):
self.precision = precision
- super(TIME, self).__init__()
+ super().__init__()
__zero_date = datetime.date(1900, 1, 1)
@@ -1273,7 +1271,7 @@ class DATETIME2(_DateTimeBase, sqltypes.DateTime):
__visit_name__ = "DATETIME2"
def __init__(self, precision=None, **kw):
- super(DATETIME2, self).__init__(**kw)
+ super().__init__(**kw)
self.precision = precision
@@ -1281,7 +1279,7 @@ class DATETIMEOFFSET(_DateTimeBase, sqltypes.DateTime):
__visit_name__ = "DATETIMEOFFSET"
def __init__(self, precision=None, **kw):
- super(DATETIMEOFFSET, self).__init__(**kw)
+ super().__init__(**kw)
self.precision = precision
@@ -1339,7 +1337,7 @@ class TIMESTAMP(sqltypes._Binary):
self.convert_int = convert_int
def result_processor(self, dialect, coltype):
- super_ = super(TIMESTAMP, self).result_processor(dialect, coltype)
+ super_ = super().result_processor(dialect, coltype)
if self.convert_int:
def process(value):
@@ -1425,7 +1423,7 @@ class VARBINARY(sqltypes.VARBINARY, sqltypes.LargeBinary):
raise ValueError(
"length must be None or 'max' when setting filestream"
)
- super(VARBINARY, self).__init__(length=length)
+ super().__init__(length=length)
class IMAGE(sqltypes.LargeBinary):
@@ -1525,12 +1523,12 @@ class UNIQUEIDENTIFIER(sqltypes.Uuid[sqltypes._UUID_RETURN]):
@overload
def __init__(
- self: "UNIQUEIDENTIFIER[_python_UUID]", as_uuid: Literal[True] = ...
+ self: UNIQUEIDENTIFIER[_python_UUID], as_uuid: Literal[True] = ...
):
...
@overload
- def __init__(self: "UNIQUEIDENTIFIER[str]", as_uuid: Literal[False] = ...):
+ def __init__(self: UNIQUEIDENTIFIER[str], as_uuid: Literal[False] = ...):
...
def __init__(self, as_uuid: bool = True):
@@ -1972,7 +1970,7 @@ class MSExecutionContext(default.DefaultExecutionContext):
and column.default.optional
):
return None
- return super(MSExecutionContext, self).get_insert_default(column)
+ return super().get_insert_default(column)
class MSSQLCompiler(compiler.SQLCompiler):
@@ -1990,7 +1988,7 @@ class MSSQLCompiler(compiler.SQLCompiler):
def __init__(self, *args, **kwargs):
self.tablealiases = {}
- super(MSSQLCompiler, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def _with_legacy_schema_aliasing(fn):
def decorate(self, *arg, **kw):
@@ -2040,7 +2038,7 @@ class MSSQLCompiler(compiler.SQLCompiler):
def get_select_precolumns(self, select, **kw):
"""MS-SQL puts TOP, it's version of LIMIT here"""
- s = super(MSSQLCompiler, self).get_select_precolumns(select, **kw)
+ s = super().get_select_precolumns(select, **kw)
if select._has_row_limiting_clause and self._use_top(select):
# ODBC drivers and possibly others
@@ -2186,20 +2184,20 @@ class MSSQLCompiler(compiler.SQLCompiler):
@_with_legacy_schema_aliasing
def visit_table(self, table, mssql_aliased=False, iscrud=False, **kwargs):
if mssql_aliased is table or iscrud:
- return super(MSSQLCompiler, self).visit_table(table, **kwargs)
+ return super().visit_table(table, **kwargs)
# alias schema-qualified tables
alias = self._schema_aliased_table(table)
if alias is not None:
return self.process(alias, mssql_aliased=table, **kwargs)
else:
- return super(MSSQLCompiler, self).visit_table(table, **kwargs)
+ return super().visit_table(table, **kwargs)
@_with_legacy_schema_aliasing
def visit_alias(self, alias, **kw):
# translate for schema-qualified table aliases
kw["mssql_aliased"] = alias.element
- return super(MSSQLCompiler, self).visit_alias(alias, **kw)
+ return super().visit_alias(alias, **kw)
@_with_legacy_schema_aliasing
def visit_column(self, column, add_to_result_map=None, **kw):
@@ -2220,9 +2218,9 @@ class MSSQLCompiler(compiler.SQLCompiler):
column.type,
)
- return super(MSSQLCompiler, self).visit_column(converted, **kw)
+ return super().visit_column(converted, **kw)
- return super(MSSQLCompiler, self).visit_column(
+ return super().visit_column(
column, add_to_result_map=add_to_result_map, **kw
)
@@ -2264,7 +2262,7 @@ class MSSQLCompiler(compiler.SQLCompiler):
),
**kwargs,
)
- return super(MSSQLCompiler, self).visit_binary(binary, **kwargs)
+ return super().visit_binary(binary, **kwargs)
def returning_clause(
self, stmt, returning_cols, *, populate_result_map, **kw
@@ -2328,9 +2326,7 @@ class MSSQLCompiler(compiler.SQLCompiler):
if isinstance(column, expression.Function):
return column.label(None)
else:
- return super(MSSQLCompiler, self).label_select_column(
- select, column, asfrom
- )
+ return super().label_select_column(select, column, asfrom)
def for_update_clause(self, select, **kw):
# "FOR UPDATE" is only allowed on "DECLARE CURSOR" which
@@ -2517,9 +2513,7 @@ class MSSQLStrictCompiler(MSSQLCompiler):
# SQL Server wants single quotes around the date string.
return "'" + str(value) + "'"
else:
- return super(MSSQLStrictCompiler, self).render_literal_value(
- value, type_
- )
+ return super().render_literal_value(value, type_)
class MSDDLCompiler(compiler.DDLCompiler):
@@ -2704,7 +2698,7 @@ class MSDDLCompiler(compiler.DDLCompiler):
schema_name = schema if schema else self.dialect.default_schema_name
return (
"execute sp_addextendedproperty 'MS_Description', "
- "{0}, 'schema', {1}, 'table', {2}".format(
+ "{}, 'schema', {}, 'table', {}".format(
self.sql_compiler.render_literal_value(
create.element.comment, sqltypes.NVARCHAR()
),
@@ -2718,7 +2712,7 @@ class MSDDLCompiler(compiler.DDLCompiler):
schema_name = schema if schema else self.dialect.default_schema_name
return (
"execute sp_dropextendedproperty 'MS_Description', 'schema', "
- "{0}, 'table', {1}".format(
+ "{}, 'table', {}".format(
self.preparer.quote_schema(schema_name),
self.preparer.format_table(drop.element, use_schema=False),
)
@@ -2729,7 +2723,7 @@ class MSDDLCompiler(compiler.DDLCompiler):
schema_name = schema if schema else self.dialect.default_schema_name
return (
"execute sp_addextendedproperty 'MS_Description', "
- "{0}, 'schema', {1}, 'table', {2}, 'column', {3}".format(
+ "{}, 'schema', {}, 'table', {}, 'column', {}".format(
self.sql_compiler.render_literal_value(
create.element.comment, sqltypes.NVARCHAR()
),
@@ -2746,7 +2740,7 @@ class MSDDLCompiler(compiler.DDLCompiler):
schema_name = schema if schema else self.dialect.default_schema_name
return (
"execute sp_dropextendedproperty 'MS_Description', 'schema', "
- "{0}, 'table', {1}, 'column', {2}".format(
+ "{}, 'table', {}, 'column', {}".format(
self.preparer.quote_schema(schema_name),
self.preparer.format_table(
drop.element.table, use_schema=False
@@ -2760,9 +2754,7 @@ class MSDDLCompiler(compiler.DDLCompiler):
if create.element.data_type is not None:
data_type = create.element.data_type
prefix = " AS %s" % self.type_compiler.process(data_type)
- return super(MSDDLCompiler, self).visit_create_sequence(
- create, prefix=prefix, **kw
- )
+ return super().visit_create_sequence(create, prefix=prefix, **kw)
def visit_identity_column(self, identity, **kw):
text = " IDENTITY"
@@ -2777,7 +2769,7 @@ class MSIdentifierPreparer(compiler.IdentifierPreparer):
reserved_words = RESERVED_WORDS
def __init__(self, dialect):
- super(MSIdentifierPreparer, self).__init__(
+ super().__init__(
dialect,
initial_quote="[",
final_quote="]",
@@ -3067,7 +3059,7 @@ class MSDialect(default.DefaultDialect):
)
self.legacy_schema_aliasing = legacy_schema_aliasing
- super(MSDialect, self).__init__(**opts)
+ super().__init__(**opts)
self._json_serializer = json_serializer
self._json_deserializer = json_deserializer
@@ -3075,7 +3067,7 @@ class MSDialect(default.DefaultDialect):
def do_savepoint(self, connection, name):
# give the DBAPI a push
connection.exec_driver_sql("IF @@TRANCOUNT = 0 BEGIN TRANSACTION")
- super(MSDialect, self).do_savepoint(connection, name)
+ super().do_savepoint(connection, name)
def do_release_savepoint(self, connection, name):
# SQL Server does not support RELEASE SAVEPOINT
@@ -3083,7 +3075,7 @@ class MSDialect(default.DefaultDialect):
def do_rollback(self, dbapi_connection):
try:
- super(MSDialect, self).do_rollback(dbapi_connection)
+ super().do_rollback(dbapi_connection)
except self.dbapi.ProgrammingError as e:
if self.ignore_no_transaction_on_rollback and re.match(
r".*\b111214\b", str(e)
@@ -3097,15 +3089,13 @@ class MSDialect(default.DefaultDialect):
else:
raise
- _isolation_lookup = set(
- [
- "SERIALIZABLE",
- "READ UNCOMMITTED",
- "READ COMMITTED",
- "REPEATABLE READ",
- "SNAPSHOT",
- ]
- )
+ _isolation_lookup = {
+ "SERIALIZABLE",
+ "READ UNCOMMITTED",
+ "READ COMMITTED",
+ "REPEATABLE READ",
+ "SNAPSHOT",
+ }
def get_isolation_level_values(self, dbapi_connection):
return list(self._isolation_lookup)
@@ -3134,7 +3124,7 @@ class MSDialect(default.DefaultDialect):
"SQL Server version."
)
- view_name = "sys.{}".format(row[0])
+ view_name = f"sys.{row[0]}"
cursor.execute(
"""
@@ -3164,7 +3154,7 @@ class MSDialect(default.DefaultDialect):
cursor.close()
def initialize(self, connection):
- super(MSDialect, self).initialize(connection)
+ super().initialize(connection)
self._setup_version_attributes()
self._setup_supports_nvarchar_max(connection)
@@ -3298,7 +3288,7 @@ class MSDialect(default.DefaultDialect):
connection.scalar(
# U filters on user tables only.
text("SELECT object_id(:table_name, 'U')"),
- {"table_name": "tempdb.dbo.[{}]".format(tablename)},
+ {"table_name": f"tempdb.dbo.[{tablename}]"},
)
)
else:
diff --git a/lib/sqlalchemy/dialects/mssql/pymssql.py b/lib/sqlalchemy/dialects/mssql/pymssql.py
index 96d03a908..5d859765c 100644
--- a/lib/sqlalchemy/dialects/mssql/pymssql.py
+++ b/lib/sqlalchemy/dialects/mssql/pymssql.py
@@ -42,7 +42,7 @@ class _MSNumeric_pymssql(sqltypes.Numeric):
class MSIdentifierPreparer_pymssql(MSIdentifierPreparer):
def __init__(self, dialect):
- super(MSIdentifierPreparer_pymssql, self).__init__(dialect)
+ super().__init__(dialect)
# pymssql has the very unusual behavior that it uses pyformat
# yet does not require that percent signs be doubled
self._double_percents = False
@@ -119,9 +119,7 @@ class MSDialect_pymssql(MSDialect):
dbapi_connection.autocommit(True)
else:
dbapi_connection.autocommit(False)
- super(MSDialect_pymssql, self).set_isolation_level(
- dbapi_connection, level
- )
+ super().set_isolation_level(dbapi_connection, level)
dialect = MSDialect_pymssql
diff --git a/lib/sqlalchemy/dialects/mssql/pyodbc.py b/lib/sqlalchemy/dialects/mssql/pyodbc.py
index 3b8caef3b..07cbe3a73 100644
--- a/lib/sqlalchemy/dialects/mssql/pyodbc.py
+++ b/lib/sqlalchemy/dialects/mssql/pyodbc.py
@@ -384,7 +384,7 @@ class _ms_numeric_pyodbc:
def bind_processor(self, dialect):
- super_process = super(_ms_numeric_pyodbc, self).bind_processor(dialect)
+ super_process = super().bind_processor(dialect)
if not dialect._need_decimal_fix:
return super_process
@@ -570,7 +570,7 @@ class MSExecutionContext_pyodbc(MSExecutionContext):
"""
- super(MSExecutionContext_pyodbc, self).pre_exec()
+ super().pre_exec()
# don't embed the scope_identity select into an
# "INSERT .. DEFAULT VALUES"
@@ -601,7 +601,7 @@ class MSExecutionContext_pyodbc(MSExecutionContext):
self._lastrowid = int(row[0])
else:
- super(MSExecutionContext_pyodbc, self).post_exec()
+ super().post_exec()
class MSDialect_pyodbc(PyODBCConnector, MSDialect):
@@ -648,9 +648,7 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
use_setinputsizes=True,
**params,
):
- super(MSDialect_pyodbc, self).__init__(
- use_setinputsizes=use_setinputsizes, **params
- )
+ super().__init__(use_setinputsizes=use_setinputsizes, **params)
self.use_scope_identity = (
self.use_scope_identity
and self.dbapi
@@ -674,9 +672,7 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
# SQL Server docs indicate this function isn't present prior to
# 2008. Before we had the VARCHAR cast above, pyodbc would also
# fail on this query.
- return super(MSDialect_pyodbc, self)._get_server_version_info(
- connection
- )
+ return super()._get_server_version_info(connection)
else:
version = []
r = re.compile(r"[.\-]")
@@ -688,7 +684,7 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
return tuple(version)
def on_connect(self):
- super_ = super(MSDialect_pyodbc, self).on_connect()
+ super_ = super().on_connect()
def on_connect(conn):
if super_ is not None:
@@ -723,9 +719,7 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
def do_executemany(self, cursor, statement, parameters, context=None):
if self.fast_executemany:
cursor.fast_executemany = True
- super(MSDialect_pyodbc, self).do_executemany(
- cursor, statement, parameters, context=context
- )
+ super().do_executemany(cursor, statement, parameters, context=context)
def is_disconnect(self, e, connection, cursor):
if isinstance(e, self.dbapi.Error):
@@ -743,9 +737,7 @@ class MSDialect_pyodbc(PyODBCConnector, MSDialect):
"10054",
}:
return True
- return super(MSDialect_pyodbc, self).is_disconnect(
- e, connection, cursor
- )
+ return super().is_disconnect(e, connection, cursor)
dialect = MSDialect_pyodbc
diff --git a/lib/sqlalchemy/dialects/mysql/aiomysql.py b/lib/sqlalchemy/dialects/mysql/aiomysql.py
index 896c90227..79f865cf1 100644
--- a/lib/sqlalchemy/dialects/mysql/aiomysql.py
+++ b/lib/sqlalchemy/dialects/mysql/aiomysql.py
@@ -294,14 +294,12 @@ class MySQLDialect_aiomysql(MySQLDialect_pymysql):
return pool.AsyncAdaptedQueuePool
def create_connect_args(self, url):
- return super(MySQLDialect_aiomysql, self).create_connect_args(
+ return super().create_connect_args(
url, _translate_args=dict(username="user", database="db")
)
def is_disconnect(self, e, connection, cursor):
- if super(MySQLDialect_aiomysql, self).is_disconnect(
- e, connection, cursor
- ):
+ if super().is_disconnect(e, connection, cursor):
return True
else:
str_e = str(e).lower()
diff --git a/lib/sqlalchemy/dialects/mysql/asyncmy.py b/lib/sqlalchemy/dialects/mysql/asyncmy.py
index c8f29a2f1..df8965cbb 100644
--- a/lib/sqlalchemy/dialects/mysql/asyncmy.py
+++ b/lib/sqlalchemy/dialects/mysql/asyncmy.py
@@ -304,14 +304,12 @@ class MySQLDialect_asyncmy(MySQLDialect_pymysql):
return pool.AsyncAdaptedQueuePool
def create_connect_args(self, url):
- return super(MySQLDialect_asyncmy, self).create_connect_args(
+ return super().create_connect_args(
url, _translate_args=dict(username="user", database="db")
)
def is_disconnect(self, e, connection, cursor):
- if super(MySQLDialect_asyncmy, self).is_disconnect(
- e, connection, cursor
- ):
+ if super().is_disconnect(e, connection, cursor):
return True
else:
str_e = str(e).lower()
diff --git a/lib/sqlalchemy/dialects/mysql/base.py b/lib/sqlalchemy/dialects/mysql/base.py
index e8ddb6d1e..2525c6c32 100644
--- a/lib/sqlalchemy/dialects/mysql/base.py
+++ b/lib/sqlalchemy/dialects/mysql/base.py
@@ -1354,7 +1354,7 @@ class MySQLCompiler(compiler.SQLCompiler):
name_text = self.preparer.quote(column.name)
clauses.append("%s = %s" % (name_text, value_text))
- non_matching = set(on_duplicate.update) - set(c.key for c in cols)
+ non_matching = set(on_duplicate.update) - {c.key for c in cols}
if non_matching:
util.warn(
"Additional column names not matching "
@@ -1503,7 +1503,7 @@ class MySQLCompiler(compiler.SQLCompiler):
return "CAST(%s AS %s)" % (self.process(cast.clause, **kw), type_)
def render_literal_value(self, value, type_):
- value = super(MySQLCompiler, self).render_literal_value(value, type_)
+ value = super().render_literal_value(value, type_)
if self.dialect._backslash_escapes:
value = value.replace("\\", "\\\\")
return value
@@ -1534,7 +1534,7 @@ class MySQLCompiler(compiler.SQLCompiler):
)
return select._distinct.upper() + " "
- return super(MySQLCompiler, self).get_select_precolumns(select, **kw)
+ return super().get_select_precolumns(select, **kw)
def visit_join(self, join, asfrom=False, from_linter=None, **kwargs):
if from_linter:
@@ -1805,11 +1805,11 @@ class MySQLDDLCompiler(compiler.DDLCompiler):
table_opts = []
- opts = dict(
- (k[len(self.dialect.name) + 1 :].upper(), v)
+ opts = {
+ k[len(self.dialect.name) + 1 :].upper(): v
for k, v in table.kwargs.items()
if k.startswith("%s_" % self.dialect.name)
- )
+ }
if table.comment is not None:
opts["COMMENT"] = table.comment
@@ -1963,9 +1963,7 @@ class MySQLDDLCompiler(compiler.DDLCompiler):
return text
def visit_primary_key_constraint(self, constraint):
- text = super(MySQLDDLCompiler, self).visit_primary_key_constraint(
- constraint
- )
+ text = super().visit_primary_key_constraint(constraint)
using = constraint.dialect_options["mysql"]["using"]
if using:
text += " USING %s" % (self.preparer.quote(using))
@@ -2305,7 +2303,7 @@ class MySQLTypeCompiler(compiler.GenericTypeCompiler):
def visit_enum(self, type_, **kw):
if not type_.native_enum:
- return super(MySQLTypeCompiler, self).visit_enum(type_)
+ return super().visit_enum(type_)
else:
return self._visit_enumerated_values("ENUM", type_, type_.enums)
@@ -2351,9 +2349,7 @@ class MySQLIdentifierPreparer(compiler.IdentifierPreparer):
else:
quote = '"'
- super(MySQLIdentifierPreparer, self).__init__(
- dialect, initial_quote=quote, escape_quote=quote
- )
+ super().__init__(dialect, initial_quote=quote, escape_quote=quote)
def _quote_free_identifiers(self, *ids):
"""Unilaterally identifier-quote any number of strings."""
diff --git a/lib/sqlalchemy/dialects/mysql/enumerated.py b/lib/sqlalchemy/dialects/mysql/enumerated.py
index 8dc96fb15..350458877 100644
--- a/lib/sqlalchemy/dialects/mysql/enumerated.py
+++ b/lib/sqlalchemy/dialects/mysql/enumerated.py
@@ -84,7 +84,7 @@ class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum, _StringType):
if elem == "":
return elem
else:
- return super(ENUM, self)._object_value_for_elem(elem)
+ return super()._object_value_for_elem(elem)
def __repr__(self):
return util.generic_repr(
@@ -153,15 +153,15 @@ class SET(_StringType):
"setting retrieve_as_bitwise=True"
)
if self.retrieve_as_bitwise:
- self._bitmap = dict(
- (value, 2**idx) for idx, value in enumerate(self.values)
- )
+ self._bitmap = {
+ value: 2**idx for idx, value in enumerate(self.values)
+ }
self._bitmap.update(
(2**idx, value) for idx, value in enumerate(self.values)
)
length = max([len(v) for v in values] + [0])
kw.setdefault("length", length)
- super(SET, self).__init__(**kw)
+ super().__init__(**kw)
def column_expression(self, colexpr):
if self.retrieve_as_bitwise:
@@ -183,7 +183,7 @@ class SET(_StringType):
return None
else:
- super_convert = super(SET, self).result_processor(dialect, coltype)
+ super_convert = super().result_processor(dialect, coltype)
def process(value):
if isinstance(value, str):
@@ -201,7 +201,7 @@ class SET(_StringType):
return process
def bind_processor(self, dialect):
- super_convert = super(SET, self).bind_processor(dialect)
+ super_convert = super().bind_processor(dialect)
if self.retrieve_as_bitwise:
def process(value):
diff --git a/lib/sqlalchemy/dialects/mysql/expression.py b/lib/sqlalchemy/dialects/mysql/expression.py
index c8c693517..561803a78 100644
--- a/lib/sqlalchemy/dialects/mysql/expression.py
+++ b/lib/sqlalchemy/dialects/mysql/expression.py
@@ -107,9 +107,7 @@ class match(Generative, elements.BinaryExpression):
if kw:
raise exc.ArgumentError("unknown arguments: %s" % (", ".join(kw)))
- super(match, self).__init__(
- left, against, operators.match_op, modifiers=flags
- )
+ super().__init__(left, against, operators.match_op, modifiers=flags)
@_generative
def in_boolean_mode(self: Selfmatch) -> Selfmatch:
diff --git a/lib/sqlalchemy/dialects/mysql/mariadbconnector.py b/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
index 6327d8687..a3f288ceb 100644
--- a/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
+++ b/lib/sqlalchemy/dialects/mysql/mariadbconnector.py
@@ -102,7 +102,7 @@ class MySQLDialect_mariadbconnector(MySQLDialect):
return (99, 99, 99)
def __init__(self, **kwargs):
- super(MySQLDialect_mariadbconnector, self).__init__(**kwargs)
+ super().__init__(**kwargs)
self.paramstyle = "qmark"
if self.dbapi is not None:
if self._dbapi_version < mariadb_cpy_minimum_version:
@@ -117,9 +117,7 @@ class MySQLDialect_mariadbconnector(MySQLDialect):
return __import__("mariadb")
def is_disconnect(self, e, connection, cursor):
- if super(MySQLDialect_mariadbconnector, self).is_disconnect(
- e, connection, cursor
- ):
+ if super().is_disconnect(e, connection, cursor):
return True
elif isinstance(e, self.dbapi.Error):
str_e = str(e).lower()
@@ -188,9 +186,7 @@ class MySQLDialect_mariadbconnector(MySQLDialect):
connection.autocommit = True
else:
connection.autocommit = False
- super(MySQLDialect_mariadbconnector, self).set_isolation_level(
- connection, level
- )
+ super().set_isolation_level(connection, level)
def do_begin_twophase(self, connection, xid):
connection.execute(
diff --git a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py
index 58e92c4ab..f29a5008c 100644
--- a/lib/sqlalchemy/dialects/mysql/mysqlconnector.py
+++ b/lib/sqlalchemy/dialects/mysql/mysqlconnector.py
@@ -167,24 +167,20 @@ class MySQLDialect_mysqlconnector(MySQLDialect):
def _compat_fetchone(self, rp, charset=None):
return rp.fetchone()
- _isolation_lookup = set(
- [
- "SERIALIZABLE",
- "READ UNCOMMITTED",
- "READ COMMITTED",
- "REPEATABLE READ",
- "AUTOCOMMIT",
- ]
- )
+ _isolation_lookup = {
+ "SERIALIZABLE",
+ "READ UNCOMMITTED",
+ "READ COMMITTED",
+ "REPEATABLE READ",
+ "AUTOCOMMIT",
+ }
def _set_isolation_level(self, connection, level):
if level == "AUTOCOMMIT":
connection.autocommit = True
else:
connection.autocommit = False
- super(MySQLDialect_mysqlconnector, self)._set_isolation_level(
- connection, level
- )
+ super()._set_isolation_level(connection, level)
dialect = MySQLDialect_mysqlconnector
diff --git a/lib/sqlalchemy/dialects/mysql/mysqldb.py b/lib/sqlalchemy/dialects/mysql/mysqldb.py
index 60b9cb103..9eb1ef84a 100644
--- a/lib/sqlalchemy/dialects/mysql/mysqldb.py
+++ b/lib/sqlalchemy/dialects/mysql/mysqldb.py
@@ -137,7 +137,7 @@ class MySQLDialect_mysqldb(MySQLDialect):
preparer = MySQLIdentifierPreparer
def __init__(self, **kwargs):
- super(MySQLDialect_mysqldb, self).__init__(**kwargs)
+ super().__init__(**kwargs)
self._mysql_dbapi_version = (
self._parse_dbapi_version(self.dbapi.__version__)
if self.dbapi is not None and hasattr(self.dbapi, "__version__")
@@ -165,7 +165,7 @@ class MySQLDialect_mysqldb(MySQLDialect):
return __import__("MySQLdb")
def on_connect(self):
- super_ = super(MySQLDialect_mysqldb, self).on_connect()
+ super_ = super().on_connect()
def on_connect(conn):
if super_ is not None:
@@ -221,9 +221,7 @@ class MySQLDialect_mysqldb(MySQLDialect):
]
else:
additional_tests = []
- return super(MySQLDialect_mysqldb, self)._check_unicode_returns(
- connection, additional_tests
- )
+ return super()._check_unicode_returns(connection, additional_tests)
def create_connect_args(self, url, _translate_args=None):
if _translate_args is None:
@@ -324,9 +322,7 @@ class MySQLDialect_mysqldb(MySQLDialect):
dbapi_connection.autocommit(True)
else:
dbapi_connection.autocommit(False)
- super(MySQLDialect_mysqldb, self).set_isolation_level(
- dbapi_connection, level
- )
+ super().set_isolation_level(dbapi_connection, level)
dialect = MySQLDialect_mysqldb
diff --git a/lib/sqlalchemy/dialects/mysql/pymysql.py b/lib/sqlalchemy/dialects/mysql/pymysql.py
index 66d2f3242..8a194d7fb 100644
--- a/lib/sqlalchemy/dialects/mysql/pymysql.py
+++ b/lib/sqlalchemy/dialects/mysql/pymysql.py
@@ -65,14 +65,12 @@ class MySQLDialect_pymysql(MySQLDialect_mysqldb):
def create_connect_args(self, url, _translate_args=None):
if _translate_args is None:
_translate_args = dict(username="user")
- return super(MySQLDialect_pymysql, self).create_connect_args(
+ return super().create_connect_args(
url, _translate_args=_translate_args
)
def is_disconnect(self, e, connection, cursor):
- if super(MySQLDialect_pymysql, self).is_disconnect(
- e, connection, cursor
- ):
+ if super().is_disconnect(e, connection, cursor):
return True
elif isinstance(e, self.dbapi.Error):
str_e = str(e).lower()
diff --git a/lib/sqlalchemy/dialects/mysql/pyodbc.py b/lib/sqlalchemy/dialects/mysql/pyodbc.py
index 2d31dfe5f..f9464f39f 100644
--- a/lib/sqlalchemy/dialects/mysql/pyodbc.py
+++ b/lib/sqlalchemy/dialects/mysql/pyodbc.py
@@ -118,7 +118,7 @@ class MySQLDialect_pyodbc(PyODBCConnector, MySQLDialect):
return None
def on_connect(self):
- super_ = super(MySQLDialect_pyodbc, self).on_connect()
+ super_ = super().on_connect()
def on_connect(conn):
if super_ is not None:
diff --git a/lib/sqlalchemy/dialects/mysql/reflection.py b/lib/sqlalchemy/dialects/mysql/reflection.py
index 44bc62179..fa1b7e0b7 100644
--- a/lib/sqlalchemy/dialects/mysql/reflection.py
+++ b/lib/sqlalchemy/dialects/mysql/reflection.py
@@ -340,9 +340,9 @@ class MySQLTableDefinitionParser:
buffer = []
for row in columns:
- (name, col_type, nullable, default, extra) = [
+ (name, col_type, nullable, default, extra) = (
row[i] for i in (0, 1, 2, 4, 5)
- ]
+ )
line = [" "]
line.append(self.preparer.quote_identifier(name))
diff --git a/lib/sqlalchemy/dialects/mysql/types.py b/lib/sqlalchemy/dialects/mysql/types.py
index a74fba177..5a96b890b 100644
--- a/lib/sqlalchemy/dialects/mysql/types.py
+++ b/lib/sqlalchemy/dialects/mysql/types.py
@@ -25,7 +25,7 @@ class _NumericType:
def __init__(self, unsigned=False, zerofill=False, **kw):
self.unsigned = unsigned
self.zerofill = zerofill
- super(_NumericType, self).__init__(**kw)
+ super().__init__(**kw)
def __repr__(self):
return util.generic_repr(
@@ -43,9 +43,7 @@ class _FloatType(_NumericType, sqltypes.Float):
"You must specify both precision and scale or omit "
"both altogether."
)
- super(_FloatType, self).__init__(
- precision=precision, asdecimal=asdecimal, **kw
- )
+ super().__init__(precision=precision, asdecimal=asdecimal, **kw)
self.scale = scale
def __repr__(self):
@@ -57,7 +55,7 @@ class _FloatType(_NumericType, sqltypes.Float):
class _IntegerType(_NumericType, sqltypes.Integer):
def __init__(self, display_width=None, **kw):
self.display_width = display_width
- super(_IntegerType, self).__init__(**kw)
+ super().__init__(**kw)
def __repr__(self):
return util.generic_repr(
@@ -87,7 +85,7 @@ class _StringType(sqltypes.String):
self.unicode = unicode
self.binary = binary
self.national = national
- super(_StringType, self).__init__(**kw)
+ super().__init__(**kw)
def __repr__(self):
return util.generic_repr(
@@ -123,7 +121,7 @@ class NUMERIC(_NumericType, sqltypes.NUMERIC):
numeric.
"""
- super(NUMERIC, self).__init__(
+ super().__init__(
precision=precision, scale=scale, asdecimal=asdecimal, **kw
)
@@ -149,7 +147,7 @@ class DECIMAL(_NumericType, sqltypes.DECIMAL):
numeric.
"""
- super(DECIMAL, self).__init__(
+ super().__init__(
precision=precision, scale=scale, asdecimal=asdecimal, **kw
)
@@ -183,7 +181,7 @@ class DOUBLE(_FloatType, sqltypes.DOUBLE):
numeric.
"""
- super(DOUBLE, self).__init__(
+ super().__init__(
precision=precision, scale=scale, asdecimal=asdecimal, **kw
)
@@ -217,7 +215,7 @@ class REAL(_FloatType, sqltypes.REAL):
numeric.
"""
- super(REAL, self).__init__(
+ super().__init__(
precision=precision, scale=scale, asdecimal=asdecimal, **kw
)
@@ -243,7 +241,7 @@ class FLOAT(_FloatType, sqltypes.FLOAT):
numeric.
"""
- super(FLOAT, self).__init__(
+ super().__init__(
precision=precision, scale=scale, asdecimal=asdecimal, **kw
)
@@ -269,7 +267,7 @@ class INTEGER(_IntegerType, sqltypes.INTEGER):
numeric.
"""
- super(INTEGER, self).__init__(display_width=display_width, **kw)
+ super().__init__(display_width=display_width, **kw)
class BIGINT(_IntegerType, sqltypes.BIGINT):
@@ -290,7 +288,7 @@ class BIGINT(_IntegerType, sqltypes.BIGINT):
numeric.
"""
- super(BIGINT, self).__init__(display_width=display_width, **kw)
+ super().__init__(display_width=display_width, **kw)
class MEDIUMINT(_IntegerType):
@@ -311,7 +309,7 @@ class MEDIUMINT(_IntegerType):
numeric.
"""
- super(MEDIUMINT, self).__init__(display_width=display_width, **kw)
+ super().__init__(display_width=display_width, **kw)
class TINYINT(_IntegerType):
@@ -332,7 +330,7 @@ class TINYINT(_IntegerType):
numeric.
"""
- super(TINYINT, self).__init__(display_width=display_width, **kw)
+ super().__init__(display_width=display_width, **kw)
class SMALLINT(_IntegerType, sqltypes.SMALLINT):
@@ -353,7 +351,7 @@ class SMALLINT(_IntegerType, sqltypes.SMALLINT):
numeric.
"""
- super(SMALLINT, self).__init__(display_width=display_width, **kw)
+ super().__init__(display_width=display_width, **kw)
class BIT(sqltypes.TypeEngine):
@@ -417,7 +415,7 @@ class TIME(sqltypes.TIME):
MySQL Connector/Python.
"""
- super(TIME, self).__init__(timezone=timezone)
+ super().__init__(timezone=timezone)
self.fsp = fsp
def result_processor(self, dialect, coltype):
@@ -462,7 +460,7 @@ class TIMESTAMP(sqltypes.TIMESTAMP):
MySQL Connector/Python.
"""
- super(TIMESTAMP, self).__init__(timezone=timezone)
+ super().__init__(timezone=timezone)
self.fsp = fsp
@@ -487,7 +485,7 @@ class DATETIME(sqltypes.DATETIME):
MySQL Connector/Python.
"""
- super(DATETIME, self).__init__(timezone=timezone)
+ super().__init__(timezone=timezone)
self.fsp = fsp
@@ -533,7 +531,7 @@ class TEXT(_StringType, sqltypes.TEXT):
only the collation of character data.
"""
- super(TEXT, self).__init__(length=length, **kw)
+ super().__init__(length=length, **kw)
class TINYTEXT(_StringType):
@@ -565,7 +563,7 @@ class TINYTEXT(_StringType):
only the collation of character data.
"""
- super(TINYTEXT, self).__init__(**kwargs)
+ super().__init__(**kwargs)
class MEDIUMTEXT(_StringType):
@@ -597,7 +595,7 @@ class MEDIUMTEXT(_StringType):
only the collation of character data.
"""
- super(MEDIUMTEXT, self).__init__(**kwargs)
+ super().__init__(**kwargs)
class LONGTEXT(_StringType):
@@ -629,7 +627,7 @@ class LONGTEXT(_StringType):
only the collation of character data.
"""
- super(LONGTEXT, self).__init__(**kwargs)
+ super().__init__(**kwargs)
class VARCHAR(_StringType, sqltypes.VARCHAR):
@@ -661,7 +659,7 @@ class VARCHAR(_StringType, sqltypes.VARCHAR):
only the collation of character data.
"""
- super(VARCHAR, self).__init__(length=length, **kwargs)
+ super().__init__(length=length, **kwargs)
class CHAR(_StringType, sqltypes.CHAR):
@@ -682,7 +680,7 @@ class CHAR(_StringType, sqltypes.CHAR):
compatible with the national character set.
"""
- super(CHAR, self).__init__(length=length, **kwargs)
+ super().__init__(length=length, **kwargs)
@classmethod
def _adapt_string_for_cast(self, type_):
@@ -728,7 +726,7 @@ class NVARCHAR(_StringType, sqltypes.NVARCHAR):
"""
kwargs["national"] = True
- super(NVARCHAR, self).__init__(length=length, **kwargs)
+ super().__init__(length=length, **kwargs)
class NCHAR(_StringType, sqltypes.NCHAR):
@@ -754,7 +752,7 @@ class NCHAR(_StringType, sqltypes.NCHAR):
"""
kwargs["national"] = True
- super(NCHAR, self).__init__(length=length, **kwargs)
+ super().__init__(length=length, **kwargs)
class TINYBLOB(sqltypes._Binary):
diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py
index 6481ae483..0d51bf73d 100644
--- a/lib/sqlalchemy/dialects/oracle/base.py
+++ b/lib/sqlalchemy/dialects/oracle/base.py
@@ -813,7 +813,7 @@ class OracleCompiler(compiler.SQLCompiler):
def __init__(self, *args, **kwargs):
self.__wheres = {}
- super(OracleCompiler, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def visit_mod_binary(self, binary, operator, **kw):
return "mod(%s, %s)" % (
@@ -852,15 +852,13 @@ class OracleCompiler(compiler.SQLCompiler):
return ""
def visit_function(self, func, **kw):
- text = super(OracleCompiler, self).visit_function(func, **kw)
+ text = super().visit_function(func, **kw)
if kw.get("asfrom", False):
text = "TABLE (%s)" % func
return text
def visit_table_valued_column(self, element, **kw):
- text = super(OracleCompiler, self).visit_table_valued_column(
- element, **kw
- )
+ text = super().visit_table_valued_column(element, **kw)
text = "COLUMN_VALUE " + text
return text
@@ -1331,9 +1329,7 @@ class OracleDDLCompiler(compiler.DDLCompiler):
return "".join(table_opts)
def get_identity_options(self, identity_options):
- text = super(OracleDDLCompiler, self).get_identity_options(
- identity_options
- )
+ text = super().get_identity_options(identity_options)
text = text.replace("NO MINVALUE", "NOMINVALUE")
text = text.replace("NO MAXVALUE", "NOMAXVALUE")
text = text.replace("NO CYCLE", "NOCYCLE")
@@ -1386,9 +1382,7 @@ class OracleIdentifierPreparer(compiler.IdentifierPreparer):
def format_savepoint(self, savepoint):
name = savepoint.ident.lstrip("_")
- return super(OracleIdentifierPreparer, self).format_savepoint(
- savepoint, name
- )
+ return super().format_savepoint(savepoint, name)
class OracleExecutionContext(default.DefaultExecutionContext):
@@ -1489,7 +1483,7 @@ class OracleDialect(default.DefaultDialect):
) = enable_offset_fetch
def initialize(self, connection):
- super(OracleDialect, self).initialize(connection)
+ super().initialize(connection)
# Oracle 8i has RETURNING:
# https://docs.oracle.com/cd/A87860_01/doc/index.htm
diff --git a/lib/sqlalchemy/dialects/oracle/cx_oracle.py b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
index 5a0c0e160..0be309cd4 100644
--- a/lib/sqlalchemy/dialects/oracle/cx_oracle.py
+++ b/lib/sqlalchemy/dialects/oracle/cx_oracle.py
@@ -672,9 +672,7 @@ class _OracleBinary(_LOBDataType, sqltypes.LargeBinary):
if not dialect.auto_convert_lobs:
return None
else:
- return super(_OracleBinary, self).result_processor(
- dialect, coltype
- )
+ return super().result_processor(dialect, coltype)
class _OracleInterval(oracle.INTERVAL):
diff --git a/lib/sqlalchemy/dialects/oracle/types.py b/lib/sqlalchemy/dialects/oracle/types.py
index 60a8ebcb5..5cea62b9f 100644
--- a/lib/sqlalchemy/dialects/oracle/types.py
+++ b/lib/sqlalchemy/dialects/oracle/types.py
@@ -35,12 +35,10 @@ class NUMBER(sqltypes.Numeric, sqltypes.Integer):
if asdecimal is None:
asdecimal = bool(scale and scale > 0)
- super(NUMBER, self).__init__(
- precision=precision, scale=scale, asdecimal=asdecimal
- )
+ super().__init__(precision=precision, scale=scale, asdecimal=asdecimal)
def adapt(self, impltype):
- ret = super(NUMBER, self).adapt(impltype)
+ ret = super().adapt(impltype)
# leave a hint for the DBAPI handler
ret._is_oracle_number = True
return ret
diff --git a/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py b/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py
index 92341d2da..4bb1026a5 100644
--- a/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py
+++ b/lib/sqlalchemy/dialects/postgresql/_psycopg_common.py
@@ -60,15 +60,13 @@ class _PsycopgHStore(HSTORE):
if dialect._has_native_hstore:
return None
else:
- return super(_PsycopgHStore, self).bind_processor(dialect)
+ return super().bind_processor(dialect)
def result_processor(self, dialect, coltype):
if dialect._has_native_hstore:
return None
else:
- return super(_PsycopgHStore, self).result_processor(
- dialect, coltype
- )
+ return super().result_processor(dialect, coltype)
class _PsycopgARRAY(PGARRAY):
diff --git a/lib/sqlalchemy/dialects/postgresql/array.py b/lib/sqlalchemy/dialects/postgresql/array.py
index 3132e875e..e130eccc2 100644
--- a/lib/sqlalchemy/dialects/postgresql/array.py
+++ b/lib/sqlalchemy/dialects/postgresql/array.py
@@ -101,7 +101,7 @@ class array(expression.ExpressionClauseList[_T]):
def __init__(self, clauses, **kw):
type_arg = kw.pop("type_", None)
- super(array, self).__init__(operators.comma_op, *clauses, **kw)
+ super().__init__(operators.comma_op, *clauses, **kw)
self._type_tuple = [arg.type for arg in self.clauses]
diff --git a/lib/sqlalchemy/dialects/postgresql/asyncpg.py b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
index cd161d28e..751dc3dcf 100644
--- a/lib/sqlalchemy/dialects/postgresql/asyncpg.py
+++ b/lib/sqlalchemy/dialects/postgresql/asyncpg.py
@@ -560,7 +560,7 @@ class AsyncAdapt_asyncpg_ss_cursor(AsyncAdapt_asyncpg_cursor):
__slots__ = ("_rowbuffer",)
def __init__(self, adapt_connection):
- super(AsyncAdapt_asyncpg_ss_cursor, self).__init__(adapt_connection)
+ super().__init__(adapt_connection)
self._rowbuffer = None
def close(self):
@@ -863,9 +863,7 @@ class AsyncAdapt_asyncpg_dbapi:
class InvalidCachedStatementError(NotSupportedError):
def __init__(self, message):
- super(
- AsyncAdapt_asyncpg_dbapi.InvalidCachedStatementError, self
- ).__init__(
+ super().__init__(
message + " (SQLAlchemy asyncpg dialect will now invalidate "
"all prepared caches in response to this exception)",
)
@@ -1095,7 +1093,7 @@ class PGDialect_asyncpg(PGDialect):
"""
- super_connect = super(PGDialect_asyncpg, self).on_connect()
+ super_connect = super().on_connect()
def connect(conn):
conn.await_(self.setup_asyncpg_json_codec(conn))
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index a908ed6b7..49ee89daa 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1469,112 +1469,110 @@ from ...util.typing import TypedDict
IDX_USING = re.compile(r"^(?:btree|hash|gist|gin|[\w_]+)$", re.I)
-RESERVED_WORDS = set(
- [
- "all",
- "analyse",
- "analyze",
- "and",
- "any",
- "array",
- "as",
- "asc",
- "asymmetric",
- "both",
- "case",
- "cast",
- "check",
- "collate",
- "column",
- "constraint",
- "create",
- "current_catalog",
- "current_date",
- "current_role",
- "current_time",
- "current_timestamp",
- "current_user",
- "default",
- "deferrable",
- "desc",
- "distinct",
- "do",
- "else",
- "end",
- "except",
- "false",
- "fetch",
- "for",
- "foreign",
- "from",
- "grant",
- "group",
- "having",
- "in",
- "initially",
- "intersect",
- "into",
- "leading",
- "limit",
- "localtime",
- "localtimestamp",
- "new",
- "not",
- "null",
- "of",
- "off",
- "offset",
- "old",
- "on",
- "only",
- "or",
- "order",
- "placing",
- "primary",
- "references",
- "returning",
- "select",
- "session_user",
- "some",
- "symmetric",
- "table",
- "then",
- "to",
- "trailing",
- "true",
- "union",
- "unique",
- "user",
- "using",
- "variadic",
- "when",
- "where",
- "window",
- "with",
- "authorization",
- "between",
- "binary",
- "cross",
- "current_schema",
- "freeze",
- "full",
- "ilike",
- "inner",
- "is",
- "isnull",
- "join",
- "left",
- "like",
- "natural",
- "notnull",
- "outer",
- "over",
- "overlaps",
- "right",
- "similar",
- "verbose",
- ]
-)
+RESERVED_WORDS = {
+ "all",
+ "analyse",
+ "analyze",
+ "and",
+ "any",
+ "array",
+ "as",
+ "asc",
+ "asymmetric",
+ "both",
+ "case",
+ "cast",
+ "check",
+ "collate",
+ "column",
+ "constraint",
+ "create",
+ "current_catalog",
+ "current_date",
+ "current_role",
+ "current_time",
+ "current_timestamp",
+ "current_user",
+ "default",
+ "deferrable",
+ "desc",
+ "distinct",
+ "do",
+ "else",
+ "end",
+ "except",
+ "false",
+ "fetch",
+ "for",
+ "foreign",
+ "from",
+ "grant",
+ "group",
+ "having",
+ "in",
+ "initially",
+ "intersect",
+ "into",
+ "leading",
+ "limit",
+ "localtime",
+ "localtimestamp",
+ "new",
+ "not",
+ "null",
+ "of",
+ "off",
+ "offset",
+ "old",
+ "on",
+ "only",
+ "or",
+ "order",
+ "placing",
+ "primary",
+ "references",
+ "returning",
+ "select",
+ "session_user",
+ "some",
+ "symmetric",
+ "table",
+ "then",
+ "to",
+ "trailing",
+ "true",
+ "union",
+ "unique",
+ "user",
+ "using",
+ "variadic",
+ "when",
+ "where",
+ "window",
+ "with",
+ "authorization",
+ "between",
+ "binary",
+ "cross",
+ "current_schema",
+ "freeze",
+ "full",
+ "ilike",
+ "inner",
+ "is",
+ "isnull",
+ "join",
+ "left",
+ "like",
+ "natural",
+ "notnull",
+ "outer",
+ "over",
+ "overlaps",
+ "right",
+ "similar",
+ "verbose",
+}
colspecs = {
sqltypes.ARRAY: _array.ARRAY,
@@ -1801,7 +1799,7 @@ class PGCompiler(compiler.SQLCompiler):
)
def render_literal_value(self, value, type_):
- value = super(PGCompiler, self).render_literal_value(value, type_)
+ value = super().render_literal_value(value, type_)
if self.dialect._backslash_escapes:
value = value.replace("\\", "\\\\")
@@ -2108,14 +2106,12 @@ class PGDDLCompiler(compiler.DDLCompiler):
"create_constraint=False on this Enum datatype."
)
- text = super(PGDDLCompiler, self).visit_check_constraint(constraint)
+ text = super().visit_check_constraint(constraint)
text += self._define_constraint_validity(constraint)
return text
def visit_foreign_key_constraint(self, constraint):
- text = super(PGDDLCompiler, self).visit_foreign_key_constraint(
- constraint
- )
+ text = super().visit_foreign_key_constraint(constraint)
text += self._define_constraint_validity(constraint)
return text
@@ -2353,9 +2349,7 @@ class PGDDLCompiler(compiler.DDLCompiler):
create.element.data_type
)
- return super(PGDDLCompiler, self).visit_create_sequence(
- create, prefix=prefix, **kw
- )
+ return super().visit_create_sequence(create, prefix=prefix, **kw)
def _can_comment_on_constraint(self, ddl_instance):
constraint = ddl_instance.element
@@ -2478,7 +2472,7 @@ class PGTypeCompiler(compiler.GenericTypeCompiler):
def visit_enum(self, type_, **kw):
if not type_.native_enum or not self.dialect.supports_native_enum:
- return super(PGTypeCompiler, self).visit_enum(type_, **kw)
+ return super().visit_enum(type_, **kw)
else:
return self.visit_ENUM(type_, **kw)
@@ -2803,7 +2797,7 @@ class PGExecutionContext(default.DefaultExecutionContext):
return self._execute_scalar(exc, column.type)
- return super(PGExecutionContext, self).get_insert_default(column)
+ return super().get_insert_default(column)
class PGReadOnlyConnectionCharacteristic(
@@ -2945,7 +2939,7 @@ class PGDialect(default.DefaultDialect):
self._json_serializer = json_serializer
def initialize(self, connection):
- super(PGDialect, self).initialize(connection)
+ super().initialize(connection)
# https://www.postgresql.org/docs/9.3/static/release-9-2.html#AEN116689
self.supports_smallserial = self.server_version_info >= (9, 2)
diff --git a/lib/sqlalchemy/dialects/postgresql/dml.py b/lib/sqlalchemy/dialects/postgresql/dml.py
index b79b4a30e..645bedf17 100644
--- a/lib/sqlalchemy/dialects/postgresql/dml.py
+++ b/lib/sqlalchemy/dialects/postgresql/dml.py
@@ -266,7 +266,7 @@ class OnConflictDoUpdate(OnConflictClause):
set_=None,
where=None,
):
- super(OnConflictDoUpdate, self).__init__(
+ super().__init__(
constraint=constraint,
index_elements=index_elements,
index_where=index_where,
diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py
index ebaad2734..b0d8ef345 100644
--- a/lib/sqlalchemy/dialects/postgresql/ext.py
+++ b/lib/sqlalchemy/dialects/postgresql/ext.py
@@ -243,7 +243,7 @@ class ExcludeConstraint(ColumnCollectionConstraint):
self.ops = kw.get("ops", {})
def _set_parent(self, table, **kw):
- super(ExcludeConstraint, self)._set_parent(table)
+ super()._set_parent(table)
self._render_exprs = [
(
diff --git a/lib/sqlalchemy/dialects/postgresql/json.py b/lib/sqlalchemy/dialects/postgresql/json.py
index a8b03bd48..c68671918 100644
--- a/lib/sqlalchemy/dialects/postgresql/json.py
+++ b/lib/sqlalchemy/dialects/postgresql/json.py
@@ -221,7 +221,7 @@ class JSON(sqltypes.JSON):
.. versionadded:: 1.1
"""
- super(JSON, self).__init__(none_as_null=none_as_null)
+ super().__init__(none_as_null=none_as_null)
if astext_type is not None:
self.astext_type = astext_type
diff --git a/lib/sqlalchemy/dialects/postgresql/named_types.py b/lib/sqlalchemy/dialects/postgresql/named_types.py
index f844e9213..79b567f08 100644
--- a/lib/sqlalchemy/dialects/postgresql/named_types.py
+++ b/lib/sqlalchemy/dialects/postgresql/named_types.py
@@ -31,8 +31,8 @@ class NamedType(sqltypes.TypeEngine):
"""Base for named types."""
__abstract__ = True
- DDLGenerator: Type["NamedTypeGenerator"]
- DDLDropper: Type["NamedTypeDropper"]
+ DDLGenerator: Type[NamedTypeGenerator]
+ DDLDropper: Type[NamedTypeDropper]
create_type: bool
def create(self, bind, checkfirst=True, **kw):
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
index cb5cab178..5acd50710 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -651,7 +651,7 @@ class PGDialect_psycopg2(_PGDialect_common_psycopg):
)
def initialize(self, connection):
- super(PGDialect_psycopg2, self).initialize(connection)
+ super().initialize(connection)
self._has_native_hstore = (
self.use_native_hstore
and self._hstore_oids(connection.connection.dbapi_connection)
diff --git a/lib/sqlalchemy/dialects/postgresql/types.py b/lib/sqlalchemy/dialects/postgresql/types.py
index 81b677187..72703ff81 100644
--- a/lib/sqlalchemy/dialects/postgresql/types.py
+++ b/lib/sqlalchemy/dialects/postgresql/types.py
@@ -128,7 +128,7 @@ class TIMESTAMP(sqltypes.TIMESTAMP):
.. versionadded:: 1.4
"""
- super(TIMESTAMP, self).__init__(timezone=timezone)
+ super().__init__(timezone=timezone)
self.precision = precision
@@ -147,7 +147,7 @@ class TIME(sqltypes.TIME):
.. versionadded:: 1.4
"""
- super(TIME, self).__init__(timezone=timezone)
+ super().__init__(timezone=timezone)
self.precision = precision
diff --git a/lib/sqlalchemy/dialects/sqlite/base.py b/lib/sqlalchemy/dialects/sqlite/base.py
index c3cb10cef..4e5808f62 100644
--- a/lib/sqlalchemy/dialects/sqlite/base.py
+++ b/lib/sqlalchemy/dialects/sqlite/base.py
@@ -921,9 +921,7 @@ from ...types import VARCHAR # noqa
class _SQliteJson(JSON):
def result_processor(self, dialect, coltype):
- default_processor = super(_SQliteJson, self).result_processor(
- dialect, coltype
- )
+ default_processor = super().result_processor(dialect, coltype)
def process(value):
try:
@@ -942,7 +940,7 @@ class _DateTimeMixin:
_storage_format = None
def __init__(self, storage_format=None, regexp=None, **kw):
- super(_DateTimeMixin, self).__init__(**kw)
+ super().__init__(**kw)
if regexp is not None:
self._reg = re.compile(regexp)
if storage_format is not None:
@@ -978,7 +976,7 @@ class _DateTimeMixin:
kw["storage_format"] = self._storage_format
if self._reg:
kw["regexp"] = self._reg
- return super(_DateTimeMixin, self).adapt(cls, **kw)
+ return super().adapt(cls, **kw)
def literal_processor(self, dialect):
bp = self.bind_processor(dialect)
@@ -1037,7 +1035,7 @@ class DATETIME(_DateTimeMixin, sqltypes.DateTime):
def __init__(self, *args, **kwargs):
truncate_microseconds = kwargs.pop("truncate_microseconds", False)
- super(DATETIME, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
if truncate_microseconds:
assert "storage_format" not in kwargs, (
"You can specify only "
@@ -1215,7 +1213,7 @@ class TIME(_DateTimeMixin, sqltypes.Time):
def __init__(self, *args, **kwargs):
truncate_microseconds = kwargs.pop("truncate_microseconds", False)
- super(TIME, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
if truncate_microseconds:
assert "storage_format" not in kwargs, (
"You can specify only "
@@ -1337,7 +1335,7 @@ class SQLiteCompiler(compiler.SQLCompiler):
def visit_cast(self, cast, **kwargs):
if self.dialect.supports_cast:
- return super(SQLiteCompiler, self).visit_cast(cast, **kwargs)
+ return super().visit_cast(cast, **kwargs)
else:
return self.process(cast.clause, **kwargs)
@@ -1610,9 +1608,7 @@ class SQLiteDDLCompiler(compiler.DDLCompiler):
):
return None
- text = super(SQLiteDDLCompiler, self).visit_primary_key_constraint(
- constraint
- )
+ text = super().visit_primary_key_constraint(constraint)
on_conflict_clause = constraint.dialect_options["sqlite"][
"on_conflict"
@@ -1628,9 +1624,7 @@ class SQLiteDDLCompiler(compiler.DDLCompiler):
return text
def visit_unique_constraint(self, constraint):
- text = super(SQLiteDDLCompiler, self).visit_unique_constraint(
- constraint
- )
+ text = super().visit_unique_constraint(constraint)
on_conflict_clause = constraint.dialect_options["sqlite"][
"on_conflict"
@@ -1648,9 +1642,7 @@ class SQLiteDDLCompiler(compiler.DDLCompiler):
return text
def visit_check_constraint(self, constraint):
- text = super(SQLiteDDLCompiler, self).visit_check_constraint(
- constraint
- )
+ text = super().visit_check_constraint(constraint)
on_conflict_clause = constraint.dialect_options["sqlite"][
"on_conflict"
@@ -1662,9 +1654,7 @@ class SQLiteDDLCompiler(compiler.DDLCompiler):
return text
def visit_column_check_constraint(self, constraint):
- text = super(SQLiteDDLCompiler, self).visit_column_check_constraint(
- constraint
- )
+ text = super().visit_column_check_constraint(constraint)
if constraint.dialect_options["sqlite"]["on_conflict"] is not None:
raise exc.CompileError(
@@ -1682,9 +1672,7 @@ class SQLiteDDLCompiler(compiler.DDLCompiler):
if local_table.schema != remote_table.schema:
return None
else:
- return super(SQLiteDDLCompiler, self).visit_foreign_key_constraint(
- constraint
- )
+ return super().visit_foreign_key_constraint(constraint)
def define_constraint_remote_table(self, constraint, table, preparer):
"""Format the remote table clause of a CREATE CONSTRAINT clause."""
@@ -1741,7 +1729,7 @@ class SQLiteTypeCompiler(compiler.GenericTypeCompiler):
not isinstance(type_, _DateTimeMixin)
or type_.format_is_text_affinity
):
- return super(SQLiteTypeCompiler, self).visit_DATETIME(type_)
+ return super().visit_DATETIME(type_)
else:
return "DATETIME_CHAR"
@@ -1750,7 +1738,7 @@ class SQLiteTypeCompiler(compiler.GenericTypeCompiler):
not isinstance(type_, _DateTimeMixin)
or type_.format_is_text_affinity
):
- return super(SQLiteTypeCompiler, self).visit_DATE(type_)
+ return super().visit_DATE(type_)
else:
return "DATE_CHAR"
@@ -1759,7 +1747,7 @@ class SQLiteTypeCompiler(compiler.GenericTypeCompiler):
not isinstance(type_, _DateTimeMixin)
or type_.format_is_text_affinity
):
- return super(SQLiteTypeCompiler, self).visit_TIME(type_)
+ return super().visit_TIME(type_)
else:
return "TIME_CHAR"
@@ -1771,127 +1759,125 @@ class SQLiteTypeCompiler(compiler.GenericTypeCompiler):
class SQLiteIdentifierPreparer(compiler.IdentifierPreparer):
- reserved_words = set(
- [
- "add",
- "after",
- "all",
- "alter",
- "analyze",
- "and",
- "as",
- "asc",
- "attach",
- "autoincrement",
- "before",
- "begin",
- "between",
- "by",
- "cascade",
- "case",
- "cast",
- "check",
- "collate",
- "column",
- "commit",
- "conflict",
- "constraint",
- "create",
- "cross",
- "current_date",
- "current_time",
- "current_timestamp",
- "database",
- "default",
- "deferrable",
- "deferred",
- "delete",
- "desc",
- "detach",
- "distinct",
- "drop",
- "each",
- "else",
- "end",
- "escape",
- "except",
- "exclusive",
- "exists",
- "explain",
- "false",
- "fail",
- "for",
- "foreign",
- "from",
- "full",
- "glob",
- "group",
- "having",
- "if",
- "ignore",
- "immediate",
- "in",
- "index",
- "indexed",
- "initially",
- "inner",
- "insert",
- "instead",
- "intersect",
- "into",
- "is",
- "isnull",
- "join",
- "key",
- "left",
- "like",
- "limit",
- "match",
- "natural",
- "not",
- "notnull",
- "null",
- "of",
- "offset",
- "on",
- "or",
- "order",
- "outer",
- "plan",
- "pragma",
- "primary",
- "query",
- "raise",
- "references",
- "reindex",
- "rename",
- "replace",
- "restrict",
- "right",
- "rollback",
- "row",
- "select",
- "set",
- "table",
- "temp",
- "temporary",
- "then",
- "to",
- "transaction",
- "trigger",
- "true",
- "union",
- "unique",
- "update",
- "using",
- "vacuum",
- "values",
- "view",
- "virtual",
- "when",
- "where",
- ]
- )
+ reserved_words = {
+ "add",
+ "after",
+ "all",
+ "alter",
+ "analyze",
+ "and",
+ "as",
+ "asc",
+ "attach",
+ "autoincrement",
+ "before",
+ "begin",
+ "between",
+ "by",
+ "cascade",
+ "case",
+ "cast",
+ "check",
+ "collate",
+ "column",
+ "commit",
+ "conflict",
+ "constraint",
+ "create",
+ "cross",
+ "current_date",
+ "current_time",
+ "current_timestamp",
+ "database",
+ "default",
+ "deferrable",
+ "deferred",
+ "delete",
+ "desc",
+ "detach",
+ "distinct",
+ "drop",
+ "each",
+ "else",
+ "end",
+ "escape",
+ "except",
+ "exclusive",
+ "exists",
+ "explain",
+ "false",
+ "fail",
+ "for",
+ "foreign",
+ "from",
+ "full",
+ "glob",
+ "group",
+ "having",
+ "if",
+ "ignore",
+ "immediate",
+ "in",
+ "index",
+ "indexed",
+ "initially",
+ "inner",
+ "insert",
+ "instead",
+ "intersect",
+ "into",
+ "is",
+ "isnull",
+ "join",
+ "key",
+ "left",
+ "like",
+ "limit",
+ "match",
+ "natural",
+ "not",
+ "notnull",
+ "null",
+ "of",
+ "offset",
+ "on",
+ "or",
+ "order",
+ "outer",
+ "plan",
+ "pragma",
+ "primary",
+ "query",
+ "raise",
+ "references",
+ "reindex",
+ "rename",
+ "replace",
+ "restrict",
+ "right",
+ "rollback",
+ "row",
+ "select",
+ "set",
+ "table",
+ "temp",
+ "temporary",
+ "then",
+ "to",
+ "transaction",
+ "trigger",
+ "true",
+ "union",
+ "unique",
+ "update",
+ "using",
+ "vacuum",
+ "values",
+ "view",
+ "virtual",
+ "when",
+ "where",
+ }
class SQLiteExecutionContext(default.DefaultExecutionContext):
@@ -2454,17 +2440,14 @@ class SQLiteDialect(default.DefaultDialect):
# the names as well. SQLite saves the DDL in whatever format
# it was typed in as, so need to be liberal here.
- keys_by_signature = dict(
- (
- fk_sig(
- fk["constrained_columns"],
- fk["referred_table"],
- fk["referred_columns"],
- ),
- fk,
- )
+ keys_by_signature = {
+ fk_sig(
+ fk["constrained_columns"],
+ fk["referred_table"],
+ fk["referred_columns"],
+ ): fk
for fk in fks.values()
- )
+ }
table_data = self._get_table_sql(connection, table_name, schema=schema)
diff --git a/lib/sqlalchemy/dialects/sqlite/dml.py b/lib/sqlalchemy/dialects/sqlite/dml.py
index 9e9e68330..0777c9261 100644
--- a/lib/sqlalchemy/dialects/sqlite/dml.py
+++ b/lib/sqlalchemy/dialects/sqlite/dml.py
@@ -202,7 +202,7 @@ class OnConflictDoUpdate(OnConflictClause):
set_=None,
where=None,
):
- super(OnConflictDoUpdate, self).__init__(
+ super().__init__(
index_elements=index_elements,
index_where=index_where,
)
diff --git a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
index 53e4b0d1b..5c07f487c 100644
--- a/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
+++ b/lib/sqlalchemy/dialects/sqlite/pysqlcipher.py
@@ -124,9 +124,7 @@ class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite):
return pool.SingletonThreadPool
def on_connect_url(self, url):
- super_on_connect = super(
- SQLiteDialect_pysqlcipher, self
- ).on_connect_url(url)
+ super_on_connect = super().on_connect_url(url)
# pull the info we need from the URL early. Even though URL
# is immutable, we don't want any in-place changes to the URL
@@ -151,9 +149,7 @@ class SQLiteDialect_pysqlcipher(SQLiteDialect_pysqlite):
def create_connect_args(self, url):
plain_url = url._replace(password=None)
plain_url = plain_url.difference_update_query(self.pragmas)
- return super(SQLiteDialect_pysqlcipher, self).create_connect_args(
- plain_url
- )
+ return super().create_connect_args(plain_url)
dialect = SQLiteDialect_pysqlcipher
diff --git a/lib/sqlalchemy/dialects/sqlite/pysqlite.py b/lib/sqlalchemy/dialects/sqlite/pysqlite.py
index 19949441f..4475ccae7 100644
--- a/lib/sqlalchemy/dialects/sqlite/pysqlite.py
+++ b/lib/sqlalchemy/dialects/sqlite/pysqlite.py
@@ -536,9 +536,7 @@ class SQLiteDialect_pysqlite(SQLiteDialect):
dbapi_connection.isolation_level = None
else:
dbapi_connection.isolation_level = ""
- return super(SQLiteDialect_pysqlite, self).set_isolation_level(
- dbapi_connection, level
- )
+ return super().set_isolation_level(dbapi_connection, level)
def on_connect(self):
def regexp(a, b):