Define the behavior of a specific database and DB-API combination.
Any aspect of metadata definition, SQL query generation, execution, result-set handling, or anything else which varies between databases is defined under the general category of the Dialect. The Dialect acts as a factory for other database-specific object implementations including ExecutionContext, Compiled, DefaultGenerator, and TypeEngine.
Note
Third party dialects should not subclass .Dialect
directly. Instead, subclass .default.DefaultDialect
or
descendant class.
All dialects include the following attributes. There are many other attributes that may be supported as well:
.Compiled
class used to compile SQL statements.Compiled
class used to compile DDL statements.ExecutionContext
class used to handle statement execution~sqlalchemy.sql.compiler.IdentifierPreparer
class used to
quote identifiers.A dictionary of names that will contain as values the names of pep-249 exceptions ("IntegrityError", "OperationalError", etc) keyed to alternate class names, to support the case where a DBAPI has exception classes that aren't named as they are referred to (e.g. IntegrityError = MyException). In the vast majority of cases this dictionary is empty.
Class Method | engine_created |
A convenience hook called before returning the final _engine.Engine . |
Class Method | get_dialect_cls |
Given a URL, return the .Dialect that will be used. |
Class Method | load_provisioning |
set up the provision.py module for this dialect. |
Class Method | type_descriptor |
Transform a generic type to a dialect-specific type. |
Method | _get_default_schema_name |
Return the string name of the currently selected schema from the given connection. |
Method | _get_server_version_info |
Retrieve the server version info from the given connection. |
Method | connect |
Establish a connection using this dialect's DBAPI. |
Method | create_connect_args |
Build DB-API compatible connection arguments. |
Method | create_xid |
Create a two-phase transaction ID. |
Method | denormalize_name |
convert the given name to a case insensitive identifier for the backend if it is an all-lowercase name. |
Method | do_begin |
Provide an implementation of connection.begin(), given a DB-API connection. |
Method | do_begin_twophase |
Begin a two phase transaction on the given connection. |
Method | do_close |
Provide an implementation of connection.close(), given a DBAPI connection. |
Method | do_commit |
Provide an implementation of connection.commit(), given a DB-API connection. |
Method | do_commit_twophase |
Commit a two phase transaction on the given connection. |
Method | do_execute |
Provide an implementation of cursor.execute(statement, parameters). |
Method | do_execute_no_params |
Provide an implementation of cursor.execute(statement). |
Method | do_executemany |
Provide an implementation of cursor.executemany(statement, parameters). |
Method | do_prepare_twophase |
Prepare a two phase transaction on the given connection. |
Method | do_recover_twophase |
Recover list of uncommitted prepared two phase transaction identifiers on the given connection. |
Method | do_release_savepoint |
Release the named savepoint on a connection. |
Method | do_rollback |
Provide an implementation of connection.rollback(), given a DB-API connection. |
Method | do_rollback_to_savepoint |
Rollback a connection to the named savepoint. |
Method | do_rollback_twophase |
Rollback a two phase transaction on the given connection. |
Method | do_savepoint |
Create a savepoint with the given name. |
Method | do_set_input_sizes |
invoke the cursor.setinputsizes() method with appropriate arguments |
Method | get_check_constraints |
Return information about check constraints in table_name . |
Method | get_columns |
Return information about columns in table_name . |
Method | get_default_isolation_level |
Given a DBAPI connection, return its isolation level, or a default isolation level if one cannot be retrieved. |
Method | get_driver_connection |
Returns the connection object as returned by the external driver package. |
Method | get_foreign_keys |
Return information about foreign_keys in table_name . |
Method | get_indexes |
Return information about indexes in table_name . |
Method | get_isolation_level |
Given a DBAPI connection, return its isolation level. |
Method | get_pk_constraint |
Return information about the primary key constraint on table_name`. |
Method | get_sequence_names |
Return a list of all sequence names available in the database. |
Method | get_table_comment |
Return the "comment" for the table identified by table_name . |
Method | get_table_names |
Return a list of table names for schema . |
Method | get_temp_table_names |
Return a list of temporary table names on the given connection, if supported by the underlying backend. |
Method | get_temp_view_names |
Return a list of temporary view names on the given connection, if supported by the underlying backend. |
Method | get_unique_constraints |
Return information about unique constraints in table_name . |
Method | get_view_definition |
Return view definition. |
Method | get_view_names |
Return a list of all view names available in the database. |
Method | has_index |
Check the existence of a particular index name in the database. |
Method | has_sequence |
Check the existence of a particular sequence in the database. |
Method | has_table |
For internal dialect use, check the existence of a particular table in the database. |
Method | initialize |
Called during strategized creation of the dialect with a connection. |
Method | is_disconnect |
Return True if the given DB-API error indicates an invalid connection |
Method | normalize_name |
convert the given name to lowercase if it is detected as case insensitive. |
Method | on_connect |
return a callable which sets up a newly created DBAPI connection. |
Method | on_connect_url |
return a callable which sets up a newly created DBAPI connection. |
Method | reset_isolation_level |
Given a DBAPI connection, revert its isolation to the default. |
Method | set_isolation_level |
Given a DBAPI connection, set its isolation level. |
Class Variable | _has_events |
Undocumented |
Class Variable | supports_statement_cache |
indicates if this dialect supports caching. |
A convenience hook called before returning the final
_engine.Engine
.
If the dialect returned a different class from the
.get_dialect_cls
method, then the hook is called on both classes, first on
the dialect class returned by the .get_dialect_cls
method and
then on the class on which the method was called.
The hook should be used by dialects and/or wrappers to apply special events to the engine or its components. In particular, it allows a dialect-wrapping class to apply dialect-level events.
Given a URL, return the .Dialect
that will be used.
This is a hook that allows an external plugin to provide functionality around an existing dialect, by allowing the plugin to be loaded from the url based on an entrypoint, and then the plugin returns the actual dialect to be used.
By default this just returns the cls.
sqlalchemy.engine.default.DefaultDialect
set up the provision.py module for this dialect.
For dialects that include a provision.py module that sets up provisioning followers, this method should initiate that process.
A typical implementation would be:
@classmethod def load_provisioning(cls): __import__("mydialect.provision")
The default method assumes a module named provision.py inside the owning package of the current dialect, based on the __module__ attribute:
@classmethod def load_provisioning(cls): package = ".".join(cls.__module__.split(".")[0:-1]) try: __import__(package + ".provision") except ImportError: pass
sqlalchemy.engine.default.DefaultDialect
Transform a generic type to a dialect-specific type.
Dialect classes will usually use the
_types.adapt_type
function in the types module to
accomplish this.
The returned result is cached per dialect class so can contain no dialect-instance state.
sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Return the string name of the currently selected schema from the given connection.
This is used by the default implementation to populate the "default_schema_name" attribute and is called exactly once upon first connect.
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.dialects.firebird.kinterbasdb.FBDialect_kinterbasdb
, sqlalchemy.dialects.mssql.pymssql.MSDialect_pymssql
, sqlalchemy.dialects.mssql.pyodbc.MSDialect_pyodbc
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite
, sqlalchemy.dialects.sybase.pysybase.SybaseDialect_pysybase
Retrieve the server version info from the given connection.
This is used by the default implementation to populate the "server_version_info" attribute and is called exactly once upon first connect.
sqlalchemy.engine.default.DefaultDialect
Establish a connection using this dialect's DBAPI.
The default implementation of this method is:
def connect(self, *cargs, **cparams): return self.dbapi.connect(*cargs, **cparams)
The *cargs, **cparams parameters are generated directly
from this dialect's .Dialect.create_connect_args
method.
This method may be used for dialects that need to perform programmatic per-connection steps when a new connection is procured from the DBAPI.
See Also
.Dialect.create_connect_args
.Dialect.on_connect
Parameters | |
*cargs | positional parameters returned from the
.Dialect.create_connect_args method |
**cparams | keyword parameters returned from the
.Dialect.create_connect_args method. |
Returns | |
a DBAPI connection, typically from the PEP 249 module level .connect() function. |
sqlalchemy.engine.default.DefaultDialect
Build DB-API compatible connection arguments.
Given a .URL
object, returns a tuple
consisting of a (*args, **kwargs) suitable to send directly
to the dbapi's connect function. The arguments are sent to the
.Dialect.connect
method which then runs the DBAPI-level
connect() function.
The method typically makes use of the
.URL.translate_connect_args
method in order to generate a dictionary of options.
The default implementation is:
def create_connect_args(self, url): opts = url.translate_connect_args() opts.update(url.query) return [[], opts]
See Also
.URL.translate_connect_args
Parameters | |
url | a .URL object |
Returns | |
a tuple of (*args, **kwargs) which will be passed to the
.Dialect.connect method. |
sqlalchemy.engine.default.DefaultDialect
Create a two-phase transaction ID.
This id will be passed to do_begin_twophase(), do_rollback_twophase(), do_commit_twophase(). Its format is unspecified.
sqlalchemy.engine.default.DefaultDialect
convert the given name to a case insensitive identifier for the backend if it is an all-lowercase name.
This method is only used if the dialect defines requires_name_normalize=True.
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of connection.begin(), given a DB-API connection.
The DBAPI has no dedicated "begin" method and it is expected that transactions are implicit. This hook is provided for those DBAPIs that might need additional help in this area.
Note that .Dialect.do_begin
is not called unless a
.Transaction
object is in use. The
.Dialect.do_autocommit
hook is provided for DBAPIs that need some extra commands emitted
after a commit in order to enter the next transaction, when the
SQLAlchemy _engine.Connection
is used in its default "autocommit"
mode.
Parameters | |
dbapi_connection | a DBAPI connection, typically
proxied within a .ConnectionFairy . |
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
Parameters | |
connection | a _engine.Connection . |
xid | xid |
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of connection.close(), given a DBAPI connection.
This hook is called by the _pool.Pool
when a connection has been
detached from the pool, or is being returned beyond the normal
capacity of the pool.
sqlalchemy.engine.default.DefaultDialect
Parameters | |
dbapi_connection | a DBAPI connection, typically
proxied within a .ConnectionFairy . |
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
Parameters | |
connection | a _engine.Connection . |
xid | xid |
is_prepared | whether or not
.TwoPhaseTransaction.prepare was called. |
recover | if the recover flag was passed. |
sqlalchemy.engine.default.DefaultDialect
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of cursor.execute(statement).
The parameter collection should not be sent.
sqlalchemy.engine.default.DefaultDialect
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
Parameters | |
connection | a _engine.Connection . |
xid | xid |
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
Parameters | |
connection | a _engine.Connection . |
sqlalchemy.engine.default.DefaultDialect
Parameters | |
connection | a _engine.Connection . |
name | savepoint name. |
sqlalchemy.engine.default.DefaultDialect
Parameters | |
dbapi_connection | a DBAPI connection, typically
proxied within a .ConnectionFairy . |
sqlalchemy.engine.default.DefaultDialect
Parameters | |
connection | a _engine.Connection . |
name | savepoint name. |
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
Parameters | |
connection | a _engine.Connection . |
xid | xid |
is_prepared | whether or not
.TwoPhaseTransaction.prepare was called. |
recover | if the recover flag was passed. |
sqlalchemy.engine.default.DefaultDialect
Parameters | |
connection | a _engine.Connection . |
name | savepoint name. |
sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.asyncpg.PGDialect_asyncpg
, sqlalchemy.dialects.postgresql.pg8000.PGDialect_pg8000
invoke the cursor.setinputsizes() method with appropriate arguments
This hook is called if the dialect.use_inputsizes flag is set to True. Parameter data is passed in a list of tuples (paramname, dbtype, sqltype), where paramname is the key of the parameter in the statement, dbtype is the DBAPI datatype and sqltype is the SQLAlchemy type. The order of tuples is in the correct parameter order.
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
Return information about check constraints in table_name
.
Given a string table_name
and an optional string schema
, return
check constraint information as a list of dicts with these keys:
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Return information about columns in table_name
.
Given a _engine.Connection
, a string
table_name
, and an optional string schema
, return column
information as a list of dictionaries with these keys:
Additional column attributes may be present.
sqlalchemy.engine.default.DefaultDialect
Given a DBAPI connection, return its isolation level, or a default isolation level if one cannot be retrieved.
This method may only raise NotImplementedError and must not raise any other exception, as it is used implicitly upon first connect.
The method must return a value for a dialect that supports isolation level settings, as this level is what will be reverted towards when a per-connection isolation level change is made.
The method defaults to using the .Dialect.get_isolation_level
method unless overridden by a dialect.
sqlalchemy.engine.default.DefaultDialect
Returns the connection object as returned by the external driver package.
For normal dialects that use a DBAPI compliant driver this call will just return the connection passed as argument. For dialects that instead adapt a non DBAPI compliant driver, like when adapting an asyncio driver, this call will return the connection-like object as returned by the driver.
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Return information about foreign_keys in table_name
.
Given a _engine.Connection
, a string
table_name
, and an optional string schema
, return foreign
key information as a list of dicts with these keys:
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Return information about indexes in table_name
.
Given a _engine.Connection
, a string
table_name
and an optional string schema
, return index
information as a list of dictionaries with these keys:
sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
Given a DBAPI connection, return its isolation level.
When working with a _engine.Connection
object,
the corresponding
DBAPI connection may be procured using the
_engine.Connection.connection
accessor.
Note that this is a dialect-level method which is used as part
of the implementation of the _engine.Connection
and
_engine.Engine
isolation level facilities;
these APIs should be preferred for most typical use cases.
See Also
_engine.Connection.get_isolation_level
- view current level
_engine.Connection.default_isolation_level
- view default level
:paramref:`.Connection.execution_options.isolation_level` -
set per _engine.Connection
isolation level
:paramref:`_sa.create_engine.isolation_level` -
set per _engine.Engine
isolation level
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Return information about the primary key constraint on table_name`.
Given a _engine.Connection
, a string
table_name
, and an optional string schema
, return primary
key information as a dictionary with these keys:
sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
Return a list of all sequence names available in the database.
Parameters | |
connection | Undocumented |
schema | schema name to query, if not the default schema. |
**kw | Undocumented |
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
Return the "comment" for the table identified by table_name
.
Given a string table_name
and an optional string schema
, return
table comment information as a dictionary with this key:
Raises NotImplementedError for dialects that don't support comments.
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
schema
.sqlalchemy.databases.sqlite.SQLiteDialect
sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
Return information about unique constraints in table_name
.
Given a string table_name
and an optional string schema
, return
unique constraint information as a list of dicts with these keys:
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Return view definition.
Given a _engine.Connection
, a string
view_name
, and an optional string schema
, return the view
definition.
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
Parameters | |
connection | Undocumented |
schema | schema name to query, if not the default schema. |
**kw | Undocumented |
sqlalchemy.engine.default.DefaultDialect
Check the existence of a particular index name in the database.
Given a _engine.Connection
object, a string
table_name
and string index name, return True if an index of the
given name on the given table exists, false otherwise.
The .DefaultDialect
implements this in terms of the
.Dialect.has_table
and .Dialect.get_indexes
methods,
however dialects can implement a more performant version.
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
Check the existence of a particular sequence in the database.
Given a _engine.Connection
object and a string
sequence_name
, return True if the given sequence exists in
the database, False otherwise.
sqlalchemy.databases.firebird.FBDialect
, sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
, sqlalchemy.databases.sybase.SybaseDialect
For internal dialect use, check the existence of a particular table in the database.
Given a _engine.Connection
object, a string table_name and
optional schema name, return True if the given table exists in the
database, False otherwise.
This method serves as the underlying implementation of the
public facing .Inspector.has_table
method, and is also used
internally to implement the "checkfirst" behavior for methods like
_schema.Table.create
and _schema.MetaData.create_all
.
Note
This method is used internally by SQLAlchemy, and is
published so that third-party dialects may provide an
implementation. It is not the public API for checking for table
presence. Please use the .Inspector.has_table
method.
Alternatively, for legacy cross-compatibility, the
_engine.Engine.has_table
method may be used.
sqlalchemy.engine.default.DefaultDialect
Called during strategized creation of the dialect with a connection.
Allows dialects to configure options based on server version info or other properties.
The connection passed here is a SQLAlchemy Connection object, with full capabilities.
The initialize() method of the base dialect should be called via super().
Note
as of SQLAlchemy 1.4, this method is called before
any _engine.Dialect.on_connect
hooks are called.
sqlalchemy.engine.default.DefaultDialect
sqlalchemy.engine.default.DefaultDialect
convert the given name to lowercase if it is detected as case insensitive.
This method is only used if the dialect defines requires_name_normalize=True.
sqlalchemy.engine.default.DefaultDialect
return a callable which sets up a newly created DBAPI connection.
The callable should accept a single argument "conn" which is the DBAPI connection itself. The inner callable has no return value.
E.g.:
class MyDialect(default.DefaultDialect): # ... def on_connect(self): def do_on_connect(connection): connection.execute("SET SPECIAL FLAGS etc") return do_on_connect
This is used to set dialect-wide per-connection options such as isolation modes, Unicode modes, etc.
The "do_on_connect" callable is invoked by using the
_events.PoolEvents.connect
event
hook, then unwrapping the DBAPI connection and passing it into the
callable.
_engine.Dialect.initialize
method however.If None is returned, no event listener is generated.
See Also
.Dialect.connect
- allows the DBAPI connect() sequence
itself to be controlled.
.Dialect.on_connect_url
- supersedes
.Dialect.on_connect
to also receive the
_engine.URL
object in context.
Returns | |
a callable that accepts a single DBAPI connection as an argument, or None. |
return a callable which sets up a newly created DBAPI connection.
This method is a new hook that supersedes the
_engine.Dialect.on_connect
method when implemented by a
dialect. When not implemented by a dialect, it invokes the
_engine.Dialect.on_connect
method directly to maintain
compatibility with existing dialects. There is no deprecation
for _engine.Dialect.on_connect
expected.
The callable should accept a single argument "conn" which is the DBAPI connection itself. The inner callable has no return value.
E.g.:
class MyDialect(default.DefaultDialect): # ... def on_connect_url(self, url): def do_on_connect(connection): connection.execute("SET SPECIAL FLAGS etc") return do_on_connect
This is used to set dialect-wide per-connection options such as isolation modes, Unicode modes, etc.
This method differs from _engine.Dialect.on_connect
in that
it is passed the _engine.URL
object that's relevant to the
connect args. Normally the only way to get this is from the
_engine.Dialect.on_connect
hook is to look on the
_engine.Engine
itself, however this URL object may have been
replaced by plugins.
Note
The default implementation of
_engine.Dialect.on_connect_url
is to invoke the
_engine.Dialect.on_connect
method. Therefore if a dialect
implements this method, the _engine.Dialect.on_connect
method will not be called unless the overriding dialect calls
it directly from here.
_engine.Dialect.on_connect_url
which normally calls into _engine.Dialect.on_connect
.See Also
_engine.Dialect.on_connect
Parameters | |
url | a _engine.URL object representing the
_engine.URL that was passed to the
_engine.Dialect.create_connect_args method. |
Returns | |
a callable that accepts a single DBAPI connection as an argument, or None. |
sqlalchemy.engine.default.DefaultDialect
Given a DBAPI connection, revert its isolation to the default.
Note that this is a dialect-level method which is used as part
of the implementation of the _engine.Connection
and
_engine.Engine
isolation level facilities; these APIs should be preferred for
most typical use cases.
See Also
_engine.Connection.get_isolation_level
- view current level
_engine.Connection.default_isolation_level
- view default level
:paramref:`.Connection.execution_options.isolation_level` -
set per _engine.Connection
isolation level
:paramref:`_sa.create_engine.isolation_level` -
set per _engine.Engine
isolation level
sqlalchemy.databases.mssql.MSDialect
, sqlalchemy.databases.mysql.MySQLDialect
, sqlalchemy.databases.oracle.OracleDialect
, sqlalchemy.databases.postgresql.PGDialect
, sqlalchemy.databases.sqlite.SQLiteDialect
Given a DBAPI connection, set its isolation level.
Note that this is a dialect-level method which is used as part
of the implementation of the _engine.Connection
and
_engine.Engine
isolation level facilities; these APIs should be preferred for
most typical use cases.
See Also
_engine.Connection.get_isolation_level
- view current level
_engine.Connection.default_isolation_level
- view default level
:paramref:`.Connection.execution_options.isolation_level` -
set per _engine.Connection
isolation level
:paramref:`_sa.create_engine.isolation_level` -
set per _engine.Engine
isolation level
bool
=
sqlalchemy.engine.default.DefaultDialect
indicates if this dialect supports caching.
All dialects that are compatible with statement caching should set this flag to True directly on each dialect class and subclass that supports it. SQLAlchemy tests that this flag is locally present on each dialect subclass before it will use statement caching. This is to provide safety for legacy or new dialects that are not yet fully tested to be compliant with SQL statement caching.
See Also