class Dialect(EventTarget): (source)
Known subclasses: sqlalchemy.connectors.Connector
, sqlalchemy.engine.default.DefaultDialect
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 :class:`.Dialect` directly. Instead, subclass :class:`.default.DefaultDialect` or descendant class.
Class Method | engine |
A convenience hook called before returning the final :class:`_engine.Engine`. |
Class Method | get |
Given a URL, return the :class:`.Dialect` that will be used by an async engine. |
Class Method | get |
Given a URL, return the :class:`.Dialect` that will be used. |
Class Method | import |
Import the DBAPI module that is used by this dialect. |
Class Method | load |
set up the provision.py module for this dialect. |
Class Method | type |
Transform a generic type to a dialect-specific type. |
Method | connect |
Establish a connection using this dialect's DBAPI. |
Method | create |
Build DB-API compatible connection arguments. |
Method | create |
Create a two-phase transaction ID. |
Method | denormalize |
convert the given name to a case insensitive identifier for the backend if it is an all-lowercase name. |
Method | do |
Provide an implementation of ``connection.begin()``, given a DB-API connection. |
Method | do |
Begin a two phase transaction on the given connection. |
Method | do |
Provide an implementation of ``connection.close()``, given a DBAPI connection. |
Method | do |
Provide an implementation of ``connection.commit()``, given a DB-API connection. |
Method | do |
Commit a two phase transaction on the given connection. |
Method | do |
Provide an implementation of ``cursor.execute(statement, parameters)``. |
Method | do |
Provide an implementation of ``cursor.execute(statement)``. |
Method | do |
Provide an implementation of ``cursor.executemany(statement, parameters)``. |
Method | do |
ping the DBAPI connection and return True if the connection is usable. |
Method | do |
Prepare a two phase transaction on the given connection. |
Method | do |
Recover list of uncommitted prepared two phase transaction identifiers on the given connection. |
Method | do |
Release the named savepoint on a connection. |
Method | do |
Provide an implementation of ``connection.rollback()``, given a DB-API connection. |
Method | do |
Rollback a connection to the named savepoint. |
Method | do |
Rollback a two phase transaction on the given connection. |
Method | do |
Create a savepoint with the given name. |
Method | do |
invoke the cursor.setinputsizes() method with appropriate arguments |
Method | do |
Provide an implementation of ``connection.close()`` that tries as much as possible to not block, given a DBAPI connection. |
Method | get |
Return information about check constraints in ``table_name``. |
Method | get |
Return information about columns in ``table_name``. |
Method | get |
Given a DBAPI connection, return its isolation level, or a default isolation level if one cannot be retrieved. |
Method | get |
return a Pool class to use for a given URL |
Method | get |
Returns the connection object as returned by the external driver package. |
Method | get |
Return information about foreign_keys in ``table_name``. |
Method | get |
Return information about indexes in ``table_name``. |
Method | get |
Given a DBAPI connection, return its isolation level. |
Method | get |
return a sequence of string isolation level names that are accepted by this dialect. |
Method | get |
Return a list of all materialized view names available in the database. |
Method | get |
Return information about check constraints in all tables in the given ``schema``. |
Method | get |
Return information about columns in all tables in the given ``schema``. |
Method | get |
Return information about foreign_keys in all tables in the given ``schema``. |
Method | get |
Return information about indexes in in all tables in the given ``schema``. |
Method | get |
Return information about primary key constraints in all tables in the given ``schema``. |
Method | get |
Return information about the table comment in all tables in the given ``schema``. |
Method | get |
Return a dictionary of options specified when the tables in the given schema were created. |
Method | get |
Return information about unique constraints in all tables in the given ``schema``. |
Method | get |
Return information about the primary key constraint on table_name`. |
Method | get |
Return a list of all schema names available in the database. |
Method | get |
Return a list of all sequence names available in the database. |
Method | get |
Return the "comment" for the table identified by ``table_name``. |
Method | get |
Return a list of table names for ``schema``. |
Method | get |
Return a dictionary of options specified when ``table_name`` was created. |
Method | get |
Return a list of temporary table names on the given connection, if supported by the underlying backend. |
Method | get |
Return a list of temporary view names on the given connection, if supported by the underlying backend. |
Method | get |
Return information about unique constraints in ``table_name``. |
Method | get |
Return plain or materialized view definition. |
Method | get |
Return a list of all non-materialized view names available in the database. |
Method | has |
Check the existence of a particular index name in the database. |
Method | has |
Check the existence of a particular schema name in the database. |
Method | has |
Check the existence of a particular sequence in the database. |
Method | has |
For internal dialect use, check the existence of a particular table or view in the database. |
Method | initialize |
Called during strategized creation of the dialect with a connection. |
Method | is |
Return True if the given DB-API error indicates an invalid connection |
Method | normalize |
convert the given name to lowercase if it is detected as case insensitive. |
Method | on |
return a callable which sets up a newly created DBAPI connection. |
Method | on |
return a callable which sets up a newly created DBAPI connection. |
Method | reset |
Given a DBAPI connection, revert its isolation to the default. |
Method | set |
Establish execution options for a given connection. |
Method | set |
Establish execution options for a given engine. |
Method | set |
Given a DBAPI connection, set its isolation level. |
Class Variable | colspecs |
A dictionary of TypeEngine classes from sqlalchemy.types mapped to subclasses that are specific to the dialect class. This dictionary is class-level only and is not accessed from the dialect instance itself. |
Class Variable | compiler |
Undocumented |
Class Variable | construct |
Optional set of argument specifiers for various SQLAlchemy constructs, typically schema items. |
Class Variable | cte |
target database, when given a CTE with an INSERT statement, needs the CTE to be below the INSERT |
Class Variable | dbapi |
A reference to the DBAPI module object itself. |
Class Variable | ddl |
a :class:`.Compiled` class used to compile DDL statements |
Class Variable | default |
the isolation that is implicitly present on new connections |
Class Variable | default |
for INSERT... VALUES (DEFAULT) syntax, the token to put in the parenthesis. |
Class Variable | default |
the name of the default schema. This value is only available for supporting dialects, and is typically populated during the initial connection to the database. |
Class Variable | default |
the default value that will be rendered as the "START WITH" portion of a CREATE SEQUENCE DDL statement. |
Class Variable | delete |
dialect supports DELETE..RETURNING with executemany. |
Class Variable | delete |
if the dialect supports RETURNING with DELETE |
Class Variable | delete |
if the dialect supports RETURNING with DELETE..FROM |
Class Variable | dialect |
Undocumented |
Class Variable | dispatch |
Undocumented |
Class Variable | div |
target database treats the / division operator as "floor division" |
Class Variable | driver |
identifying name for the dialect's DBAPI |
Class Variable | engine |
a mapping of string keys that can be in an engine config linked to type conversion functions. |
Class Variable | exclude |
set of DBAPI type objects that should be excluded in automatic cursor.setinputsizes() calls. |
Class Variable | execute |
either the 'tuple' or 'list' type, depending on what cursor.execute() accepts for the second argument (they vary). |
Class Variable | execution |
a :class:`.ExecutionContext` class used to handle statement execution |
Class Variable | favor |
for backends that support both a lastrowid and a RETURNING insert strategy, favor RETURNING for simple single-int pk inserts. |
Class Variable | has |
Whether or not this dialect has a separate "terminate" implementation that does not block or require awaiting. |
Class Variable | identifier |
This element will refer to an instance of :class:`.IdentifierPreparer` once a :class:`.DefaultDialect` has been constructed. |
Class Variable | include |
set of DBAPI type objects that should be included in automatic cursor.setinputsizes() calls. |
Class Variable | inline |
Indicates the dialect supports comment DDL that's inline with the definition of a Table or Column. If False, this implies that ALTER must be used to set table and column comments. |
Class Variable | insert |
dialect / driver / database supports some means of providing INSERT...RETURNING support when dialect.do_executemany() is used. |
Class Variable | insert |
if the dialect supports RETURNING with INSERT |
Class Variable | insertmanyvalues |
Alternate to insertmanyvalues_page_size, will additionally limit page size based on number of parameters total in the statement. |
Class Variable | insertmanyvalues |
Number of rows to render into an individual INSERT..VALUES() statement for :attr:`.ExecuteStyle.INSERTMANYVALUES` executions. |
Class Variable | is |
Whether or not this dialect is intended for asyncio use. |
Class Variable | label |
optional user-defined max length for SQL labels |
Class Variable | max |
The maximum length of identifier names. |
Class Variable | name |
identifying name for the dialect from a DBAPI-neutral point of view (i.e. 'sqlite') |
Class Variable | paramstyle |
the paramstyle to be used (some DB-APIs support multiple paramstyles). |
Class Variable | positional |
True if the paramstyle for this Dialect is positional. |
Class Variable | preexecute |
True if 'implicit' primary key functions must be executed separately in order to get their value, if RETURNING is not used. |
Class Variable | preparer |
a :class:`.IdentifierPreparer` class used to quote identifiers. |
Class Variable | reflection |
Sequence of string names indicating keyword arguments that can be established on a :class:`.Table` object which will be passed as "reflection options" when using :paramref:`.Table.autoload_with`. |
Class Variable | sequences |
If True, indicates if the :paramref:`_schema.Sequence.optional` parameter on the :class:`_schema.Sequence` construct should signal to not generate a CREATE SEQUENCE. Applies only to dialects that support sequences... |
Class Variable | server |
deprecated; indicates if the dialect should attempt to use server side cursors by default |
Class Variable | server |
a tuple containing a version number for the DB backend in use. |
Class Variable | statement |
a :class:`.Compiled` class used to compile SQL statements |
Class Variable | supports |
``True`` if the database supports ``ALTER TABLE`` - used only for generating foreign key constraints in certain circumstances |
Class Variable | supports |
Indicates the dialect supports comment DDL on tables and columns. |
Class Variable | supports |
Indicates if the dialect supports comment DDL on constraints. |
Class Variable | supports |
dialect supports INSERT...(col) VALUES (DEFAULT) syntax. |
Class Variable | supports |
dialect supports INSERT... DEFAULT VALUES syntax |
Class Variable | supports |
dialect supports INSERT () VALUES (), i.e. a plain INSERT with no columns in it. |
Class Variable | supports |
target database supports IDENTITY |
Class Variable | supports |
Target database supports INSERT...VALUES with multiple value sets, i.e. INSERT INTO table (cols) VALUES (...), (...), (...), ... |
Class Variable | supports |
Indicates if the dialect supports a native boolean construct. This will prevent :class:`_types.Boolean` from generating a CHECK constraint when that type is used. |
Class Variable | supports |
indicates if Decimal objects are handled and returned for precision numeric types, or if floats are returned |
Class Variable | supports |
Indicates if the dialect supports a native ENUM construct. This will prevent :class:`_types.Enum` from generating a CHECK constraint when that type is used in "native" mode. |
Class Variable | supports |
indicates if Python UUID() objects are handled natively by the driver for SQL UUID datatypes. |
Class Variable | supports |
Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements when executed via executemany. |
Class Variable | supports |
Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements. |
Class Variable | supports |
Indicates if the dialect supports CREATE SEQUENCE or similar. |
Class Variable | supports |
indicates if the dialect supports server side cursors |
Class Variable | supports |
target database supports ORDER BY <labelname>, where <labelname> refers to a label in the columns clause of the SELECT |
Class Variable | supports |
indicates if this dialect supports caching. |
Class Variable | tuple |
target database supports tuple IN, i.e. (x, y) IN ((q, p), (r, z)) |
Class Variable | type |
legacy; this is a TypeCompiler class at the class level, a TypeCompiler instance at the instance level. |
Class Variable | type |
a :class:`.Compiled` class used to compile SQL type objects |
Class Variable | type |
instance of a :class:`.Compiled` class used to compile SQL type objects |
Class Variable | update |
dialect supports UPDATE..RETURNING with executemany. |
Class Variable | update |
if the dialect supports RETURNING with UPDATE |
Class Variable | update |
if the dialect supports RETURNING with UPDATE..FROM |
Class Variable | use |
if True, indicates "insertmanyvalues" functionality should be used to allow for ``insert_executemany_returning`` behavior, if possible. |
Class Variable | use |
if True, and use_insertmanyvalues is also True, INSERT statements that don't include RETURNING will also use "insertmanyvalues". |
Property | loaded |
same as .dbapi, but is never None; will raise an error if no DBAPI was set up. |
Method | _assert |
Undocumented |
Method | _builtin |
Undocumented |
Method | _deliver |
convert executemany parameters for an INSERT into an iterator of statement/single execute values, used by the insertmanyvalues feature. |
Method | _do |
Undocumented |
Method | _get |
Return the string name of the currently selected schema from the given connection. |
Method | _get |
Retrieve the server version info from the given connection. |
Method | _overrides |
Undocumented |
Class Variable | _bind |
Undocumented |
Class Variable | _has |
Undocumented |
Class Variable | _on |
Undocumented |
Class Variable | _supports |
internal evaluation for supports_statement_cache |
Class Variable | _type |
Undocumented |
A convenience hook called before returning the final :class:`_engine.Engine`. If the dialect returned a different class from the :meth:`.get_dialect_cls` method, then the hook is called on both classes, first on the dialect class returned by the :meth:`.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. .. versionadded:: 1.0.3
sqlalchemy.dialects.postgresql.psycopg.PGDialect_psycopg
Given a URL, return the :class:`.Dialect` that will be used by an async engine. By default this is an alias of :meth:`.Dialect.get_dialect_cls` and just returns the cls. It may be used if a dialect provides both a sync and async version under the same name, like the ``psycopg`` driver. .. versionadded:: 2 .. seealso:: :meth:`.Dialect.get_dialect_cls`
Given a URL, return the :class:`.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. .. versionadded:: 1.0.3
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.dialects.mssql.pymssql.MSDialect_pymssql
, sqlalchemy.dialects.mysql.mariadbconnector.MySQLDialect_mariadbconnector
, sqlalchemy.dialects.mysql.mysqlconnector.MySQLDialect_mysqlconnector
, sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.asyncpg.PGDialect_asyncpg
, sqlalchemy.dialects.postgresql.pg8000.PGDialect_pg8000
, sqlalchemy.dialects.postgresql.psycopg.PGDialect_psycopg
, sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2
, sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite
Import the DBAPI module that is used by this dialect. The Python module object returned here will be assigned as an instance variable to a constructed dialect under the name ``.dbapi``. .. versionchanged:: 2.0 The :meth:`.Dialect.import_dbapi` class method is renamed from the previous method ``.Dialect.dbapi()``, which would be replaced at dialect instantiation time by the DBAPI module itself, thus using the same name in two different ways. If a ``.Dialect.dbapi()`` classmethod is present on a third-party dialect, it will be used and a deprecation warning will be emitted.
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 .. versionadded:: 1.3.14
sqlalchemy.engine.default.DefaultDialect
Transform a generic type to a dialect-specific type. Dialect classes will usually use the :func:`_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.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 :meth:`.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. :param \*cargs: positional parameters returned from the :meth:`.Dialect.create_connect_args` method :param \*\*cparams: keyword parameters returned from the :meth:`.Dialect.create_connect_args` method. :return: a DBAPI connection, typically from the :pep:`249` module level ``.connect()`` function. .. seealso:: :meth:`.Dialect.create_connect_args` :meth:`.Dialect.on_connect`
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.engine.default.DefaultDialect
Build DB-API compatible connection arguments. Given a :class:`.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 :meth:`.Dialect.connect` method which then runs the DBAPI-level ``connect()`` function. The method typically makes use of the :meth:`.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] :param url: a :class:`.URL` object :return: a tuple of ``(*args, **kwargs)`` which will be passed to the :meth:`.Dialect.connect` method. .. seealso:: :meth:`.URL.translate_connect_args`
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. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`.
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
Begin a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of ``connection.close()``, given a DBAPI connection. This hook is called by the :class:`_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
Provide an implementation of ``connection.commit()``, given a DB-API connection. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`.
Connection
, xid: Any
, is_prepared: bool
= True, recover: bool
= False):
(source)
¶
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
Commit a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid :param is_prepared: whether or not :meth:`.TwoPhaseTransaction.prepare` was called. :param recover: if the recover flag was passed.
DBAPICursor
, statement: str
, parameters: Optional[ _DBAPISingleExecuteParams]
, context: Optional[ ExecutionContext]
= None):
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of ``cursor.execute(statement, parameters)``.
DBAPICursor
, statement: str
, context: Optional[ ExecutionContext]
= None):
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of ``cursor.execute(statement)``. The parameter collection should not be sent.
DBAPICursor
, statement: str
, parameters: _DBAPIMultiExecuteParams
, context: Optional[ ExecutionContext]
= None):
(source)
¶
sqlalchemy.dialects.mssql.pyodbc.MSDialect_pyodbc
, sqlalchemy.engine.default.DefaultDialect
Provide an implementation of ``cursor.executemany(statement, parameters)``.
sqlalchemy.engine.default.DefaultDialect
ping the DBAPI connection and return True if the connection is usable.
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
Prepare a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
Recover list of uncommitted prepared two phase transaction identifiers on the given connection. :param connection: a :class:`_engine.Connection`.
sqlalchemy.engine.default.DefaultDialect
Release the named savepoint on a connection. :param connection: a :class:`_engine.Connection`. :param name: savepoint name.
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of ``connection.rollback()``, given a DB-API connection. :param dbapi_connection: a DBAPI connection, typically proxied within a :class:`.ConnectionFairy`.
sqlalchemy.engine.default.DefaultDialect
Rollback a connection to the named savepoint. :param connection: a :class:`_engine.Connection`. :param name: savepoint name.
Connection
, xid: Any
, is_prepared: bool
= True, recover: bool
= False):
(source)
¶
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
Rollback a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid :param is_prepared: whether or not :meth:`.TwoPhaseTransaction.prepare` was called. :param recover: if the recover flag was passed.
sqlalchemy.engine.default.DefaultDialect
Create a savepoint with the given name. :param connection: a :class:`_engine.Connection`. :param name: savepoint name.
DBAPICursor
, list_of_tuples: _GenericSetInputSizesType
, context: ExecutionContext
) -> Any
:
(source)
¶
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
invoke the cursor.setinputsizes() method with appropriate arguments This hook is called if the :attr:`.Dialect.bind_typing` attribute is set to the :attr:`.BindTyping.SETINPUTSIZES` value. 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. .. versionadded:: 1.4 .. versionchanged:: 2.0 - setinputsizes mode is now enabled by setting :attr:`.Dialect.bind_typing` to :attr:`.BindTyping.SETINPUTSIZES`. Dialects which accept a ``use_setinputsizes`` parameter should set this value appropriately.
sqlalchemy.engine.default.DefaultDialect
Provide an implementation of ``connection.close()`` that tries as much as possible to not block, given a DBAPI connection. In the vast majority of cases this just calls .close(), however for some asyncio dialects may call upon different API features. This hook is called by the :class:`_pool.Pool` when a connection is being recycled or has been invalidated. .. versionadded:: 1.4.41
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedCheckConstraint]
:
(source)
¶
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.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 corresponding to the :class:`.ReflectedCheckConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_check_constraints`. .. versionadded:: 1.1.0
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedColumn]
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return information about columns in ``table_name``. Given a :class:`_engine.Connection`, a string ``table_name``, and an optional string ``schema``, return column information as a list of dictionaries corresponding to the :class:`.ReflectedColumn` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_columns`.
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 :meth:`.Dialect.get_isolation_level` method unless overridden by a dialect. .. versionadded:: 1.3.22
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. .. versionadded:: 1.4.24
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedForeignKeyConstraint]
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return information about foreign_keys in ``table_name``. Given a :class:`_engine.Connection`, a string ``table_name``, and an optional string ``schema``, return foreign key information as a list of dicts corresponding to the :class:`.ReflectedForeignKeyConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_foreign_keys`.
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedIndex]
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return information about indexes in ``table_name``. Given a :class:`_engine.Connection`, a string ``table_name`` and an optional string ``schema``, return index information as a list of dictionaries corresponding to the :class:`.ReflectedIndex` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_indexes`.
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Given a DBAPI connection, return its isolation level. When working with a :class:`_engine.Connection` object, the corresponding DBAPI connection may be procured using the :attr:`_engine.Connection.connection` accessor. Note that this is a dialect-level method which is used as part of the implementation of the :class:`_engine.Connection` and :class:`_engine.Engine` isolation level facilities; these APIs should be preferred for most typical use cases. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current level :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level
DBAPIConnection
) -> List[ IsolationLevel]
:
(source)
¶
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
return a sequence of string isolation level names that are accepted by this dialect. The available names should use the following conventions: * use UPPERCASE names. isolation level methods will accept lowercase names but these are normalized into UPPERCASE before being passed along to the dialect. * separate words should be separated by spaces, not underscores, e.g. ``REPEATABLE READ``. isolation level names will have underscores converted to spaces before being passed along to the dialect. * The names for the four standard isolation names to the extent that they are supported by the backend should be ``READ UNCOMMITTED`` ``READ COMMITTED``, ``REPEATABLE READ``, ``SERIALIZABLE`` * if the dialect supports an autocommit option it should be provided using the isolation level name ``AUTOCOMMIT``. * Other isolation modes may also be present, provided that they are named in UPPERCASE and use spaces not underscores. This function is used so that the default dialect can check that a given isolation level parameter is valid, else raises an :class:`_exc.ArgumentError`. A DBAPI connection is passed to the method, in the unlikely event that the dialect needs to interrogate the connection itself to determine this list, however it is expected that most backends will return a hardcoded list of values. If the dialect supports "AUTOCOMMIT", that value should also be present in the sequence returned. The method raises ``NotImplementedError`` by default. If a dialect does not implement this method, then the default dialect will not perform any checking on a given isolation level value before passing it onto the :meth:`.Dialect.set_isolation_level` method. This is to allow backwards-compatibility with third party dialects that may not yet be implementing this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
Return a list of all materialized view names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_materialized_view_names`. :param schema: schema name to query, if not the default schema. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, List[ ReflectedCheckConstraint]]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about check constraints in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_check_constraints`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, List[ ReflectedColumn]]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about columns in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_columns`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, List[ ReflectedForeignKeyConstraint]]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about foreign_keys in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_multi_foreign_keys`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, List[ ReflectedIndex]]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about indexes in in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_indexes`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, ReflectedPrimaryKeyConstraint]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about primary key constraints in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_pk_constraint`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, ReflectedTableComment]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about the table comment in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_multi_table_comment`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, Dict[ str, Any]]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return a dictionary of options specified when the tables in the given schema were created. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_multi_table_options`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, schema: Optional[ str]
= None, filter_names: Optional[ Collection[ str]]
= None, **kw: Any
) -> Iterable[ Tuple[ TableKey, List[ ReflectedUniqueConstraint]]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Return information about unique constraints in all tables in the given ``schema``. This is an internal dialect method. Applications should use :meth:`.Inspector.get_multi_unique_constraints`. .. note:: The :class:`_engine.DefaultDialect` provides a default implementation that will call the single table method for each object returned by :meth:`Dialect.get_table_names`, :meth:`Dialect.get_view_names` or :meth:`Dialect.get_materialized_view_names` depending on the provided ``kind``. Dialects that want to support a faster implementation should implement this method. .. versionadded:: 2.0
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> ReflectedPrimaryKeyConstraint
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return information about the primary key constraint on table_name`. Given a :class:`_engine.Connection`, a string ``table_name``, and an optional string ``schema``, return primary key information as a dictionary corresponding to the :class:`.ReflectedPrimaryKeyConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_pk_constraint`.
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return a list of all schema names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_schema_names`.
Connection
, schema: Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
Return a list of all sequence names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_sequence_names`. :param schema: schema name to query, if not the default schema. .. versionadded:: 1.4
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> ReflectedTableComment
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.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 corresponding to the :class:`.ReflectedTableComment` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_table_comment`. :raise: ``NotImplementedError`` for dialects that don't support comments. .. versionadded:: 1.2
Connection
, schema: Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return a list of table names for ``schema``. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_table_names`.
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> Dict[ str, Any]
:
(source)
¶
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
Return a dictionary of options specified when ``table_name`` was created. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_table_options`.
Connection
, schema: Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return a list of temporary table names on the given connection, if supported by the underlying backend. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_temp_table_names`.
Connection
, schema: Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return a list of temporary view names on the given connection, if supported by the underlying backend. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_temp_view_names`.
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> List[ ReflectedUniqueConstraint]
:
(source)
¶
sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.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 corresponding to the :class:`.ReflectedUniqueConstraint` dictionary. This is an internal dialect method. Applications should use :meth:`.Inspector.get_unique_constraints`.
Connection
, view_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> str
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return plain or materialized view definition. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_view_definition`. Given a :class:`_engine.Connection`, a string ``view_name``, and an optional string ``schema``, return the view definition.
Connection
, schema: Optional[ str]
= None, **kw: Any
) -> List[ str]
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Return a list of all non-materialized view names available in the database. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.get_view_names`. :param schema: schema name to query, if not the default schema.
Connection
, table_name: str
, index_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> bool
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Check the existence of a particular index name in the database. Given a :class:`_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 :class:`.DefaultDialect` implements this in terms of the :meth:`.Dialect.has_table` and :meth:`.Dialect.get_indexes` methods, however dialects can implement a more performant version. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.has_index`. .. versionadded:: 1.4
sqlalchemy.engine.default.DefaultDialect
Check the existence of a particular schema name in the database. Given a :class:`_engine.Connection` object, a string ``schema_name``, return ``True`` if a schema of the given exists, ``False`` otherwise. The :class:`.DefaultDialect` implements this by checking the presence of ``schema_name`` among the schemas returned by :meth:`.Dialect.get_schema_names`, however dialects can implement a more performant version. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.has_schema`. .. versionadded:: 2.0
Connection
, sequence_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> bool
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
Check the existence of a particular sequence in the database. Given a :class:`_engine.Connection` object and a string `sequence_name`, return ``True`` if the given sequence exists in the database, ``False`` otherwise. This is an internal dialect method. Applications should use :meth:`_engine.Inspector.has_sequence`.
Connection
, table_name: str
, schema: Optional[ str]
= None, **kw: Any
) -> bool
:
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
For internal dialect use, check the existence of a particular table or view in the database. Given a :class:`_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 :meth:`.Inspector.has_table` method, and is also used internally to implement the "checkfirst" behavior for methods like :meth:`_schema.Table.create` and :meth:`_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 :meth:`.Inspector.has_table` method. .. versionchanged:: 2.0:: :meth:`_engine.Dialect.has_table` now formally supports checking for additional table-like objects: * any type of views (plain or materialized) * temporary tables of any kind Previously, these two checks were not formally specified and different dialects would vary in their behavior. The dialect testing suite now includes tests for all of these object types, and dialects to the degree that the backing database supports views or temporary tables should seek to support locating these objects for full compliance.
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 :meth:`_engine.Dialect.on_connect` hooks are called.
Exception
, connection: Optional[ Union[ PoolProxiedConnection, DBAPIConnection]]
, cursor: Optional[ DBAPICursor]
) -> bool
:
(source)
¶
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.engine.default.DefaultDialect
Return True if the given DB-API error indicates an invalid connection
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.dialects.mssql.pyodbc.MSDialect_pyodbc
, sqlalchemy.dialects.mysql.pyodbc.MySQLDialect_pyodbc
, 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 :meth:`_events.PoolEvents.connect` event hook, then unwrapping the DBAPI connection and passing it into the callable. .. versionchanged:: 1.4 the on_connect hook is no longer called twice for the first connection of a dialect. The on_connect hook is still called before the :meth:`_engine.Dialect.initialize` method however. .. versionchanged:: 1.4.3 the on_connect hook is invoked from a new method on_connect_url that passes the URL that was used to create the connect args. Dialects can implement on_connect_url instead of on_connect if they need the URL object that was used for the connection in order to get additional context. If None is returned, no event listener is generated. :return: a callable that accepts a single DBAPI connection as an argument, or None. .. seealso:: :meth:`.Dialect.connect` - allows the DBAPI ``connect()`` sequence itself to be controlled. :meth:`.Dialect.on_connect_url` - supersedes :meth:`.Dialect.on_connect` to also receive the :class:`_engine.URL` object in context.
return a callable which sets up a newly created DBAPI connection. This method is a new hook that supersedes the :meth:`_engine.Dialect.on_connect` method when implemented by a dialect. When not implemented by a dialect, it invokes the :meth:`_engine.Dialect.on_connect` method directly to maintain compatibility with existing dialects. There is no deprecation for :meth:`_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 :meth:`_engine.Dialect.on_connect` in that it is passed the :class:`_engine.URL` object that's relevant to the connect args. Normally the only way to get this is from the :meth:`_engine.Dialect.on_connect` hook is to look on the :class:`_engine.Engine` itself, however this URL object may have been replaced by plugins. .. note:: The default implementation of :meth:`_engine.Dialect.on_connect_url` is to invoke the :meth:`_engine.Dialect.on_connect` method. Therefore if a dialect implements this method, the :meth:`_engine.Dialect.on_connect` method **will not be called** unless the overriding dialect calls it directly from here. .. versionadded:: 1.4.3 added :meth:`_engine.Dialect.on_connect_url` which normally calls into :meth:`_engine.Dialect.on_connect`. :param url: a :class:`_engine.URL` object representing the :class:`_engine.URL` that was passed to the :meth:`_engine.Dialect.create_connect_args` method. :return: a callable that accepts a single DBAPI connection as an argument, or None. .. seealso:: :meth:`_engine.Dialect.on_connect`
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 :class:`_engine.Connection` and :class:`_engine.Engine` isolation level facilities; these APIs should be preferred for most typical use cases. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current level :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level
Connection
, opts: CoreExecuteOptionsParameter
):
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Establish execution options for a given connection. This is implemented by :class:`.DefaultDialect` in order to implement the :paramref:`_engine.Connection.execution_options.isolation_level` execution option. Dialects can intercept various execution options which may need to modify state on a particular DBAPI connection. .. versionadded:: 1.4
Engine
, opts: CoreExecuteOptionsParameter
):
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Establish execution options for a given engine. This is implemented by :class:`.DefaultDialect` to establish event hooks for new :class:`.Connection` instances created by the given :class:`.Engine` which will then invoke the :meth:`.Dialect.set_connection_execution_options` method for that connection.
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.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 :class:`_engine.Connection` and :class:`_engine.Engine` isolation level facilities; these APIs should be preferred for most typical use cases. If the dialect also implements the :meth:`.Dialect.get_isolation_level_values` method, then the given level is guaranteed to be one of the string names within that sequence, and the method will not need to anticipate a lookup failure. .. seealso:: :meth:`_engine.Connection.get_isolation_level` - view current level :attr:`_engine.Connection.default_isolation_level` - view default level :paramref:`.Connection.execution_options.isolation_level` - set per :class:`_engine.Connection` isolation level :paramref:`_sa.create_engine.isolation_level` - set per :class:`_engine.Engine` isolation level
sqlalchemy.dialects.mssql.pyodbc.MSDialect_pyodbc
, sqlalchemy.dialects.mysql.pyodbc.MySQLDialect_pyodbc
, sqlalchemy.engine.default.DefaultDialect
A dictionary of TypeEngine classes from sqlalchemy.types mapped to subclasses that are specific to the dialect class. This dictionary is class-level only and is not accessed from the dialect instance itself.
Optional[ List[ Tuple[ Type[ Union[ SchemaItem, ClauseElement]], Mapping[ str, Any]]]]
=
(source)
¶
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
Optional set of argument specifiers for various SQLAlchemy constructs, typically schema items. To implement, establish as a series of tuples, as in:: construct_arguments = [ (schema.Index, { "using": False, "where": None, "ops": None }) ] If the above construct is established on the PostgreSQL dialect, the :class:`.Index` construct will now accept the keyword arguments ``postgresql_using``, ``postgresql_where``, nad ``postgresql_ops``. Any other argument specified to the constructor of :class:`.Index` which is prefixed with ``postgresql_`` will raise :class:`.ArgumentError`. A dialect which does not include a ``construct_arguments`` member will not participate in the argument validation system. For such a dialect, any argument name is accepted by all participating constructs, within the namespace of arguments prefixed with that dialect name. The rationale here is so that third-party dialects that haven't yet implemented this feature continue to function in the old way. .. versionadded:: 0.9.2 .. seealso:: :class:`.DialectKWArgs` - implementing base class which consumes :attr:`.DefaultDialect.construct_arguments`
sqlalchemy.engine.default.DefaultDialect
target database, when given a CTE with an INSERT statement, needs the CTE to be below the INSERT
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.engine.default.DefaultDialect
A reference to the DBAPI module object itself. SQLAlchemy dialects import DBAPI modules using the classmethod :meth:`.Dialect.import_dbapi`. The rationale is so that any dialect module can be imported and used to generate SQL statements without the need for the actual DBAPI driver to be installed. Only when an :class:`.Engine` is constructed using :func:`.create_engine` does the DBAPI get imported; at that point, the creation process will assign the DBAPI module to this attribute. Dialects should therefore implement :meth:`.Dialect.import_dbapi` which will import the necessary module and return it, and then refer to ``self.dbapi`` in dialect code in order to refer to the DBAPI module contents. .. versionchanged:: The :attr:`.Dialect.dbapi` attribute is exclusively used as the per-:class:`.Dialect`-instance reference to the DBAPI module. The previous not-fully-documented ``.Dialect.dbapi()`` classmethod is deprecated and replaced by :meth:`.Dialect.import_dbapi`.
sqlalchemy.engine.default.DefaultDialect
the isolation that is implicitly present on new connections
sqlalchemy.engine.default.DefaultDialect
for INSERT... VALUES (DEFAULT) syntax, the token to put in the parenthesis. E.g. for SQLite this is the keyword "NULL".
sqlalchemy.engine.default.DefaultDialect
the name of the default schema. This value is only available for supporting dialects, and is typically populated during the initial connection to the database.
sqlalchemy.engine.default.DefaultDialect
the default value that will be rendered as the "START WITH" portion of a CREATE SEQUENCE DDL statement.
sqlalchemy.engine.default.DefaultDialect
dialect supports DELETE..RETURNING with executemany.
sqlalchemy.engine.default.DefaultDialect
if the dialect supports RETURNING with DELETE .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
if the dialect supports RETURNING with DELETE..FROM .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
target database treats the / division operator as "floor division"
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.dialects.mssql.pymssql.MSDialect_pymssql
, sqlalchemy.dialects.mysql.mariadbconnector.MySQLDialect_mariadbconnector
, sqlalchemy.dialects.mysql.mysqlconnector.MySQLDialect_mysqlconnector
, sqlalchemy.dialects.mysql.mysqldb.MySQLDialect_mysqldb
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.asyncpg.PGDialect_asyncpg
, sqlalchemy.dialects.postgresql.pg8000.PGDialect_pg8000
, sqlalchemy.dialects.postgresql.psycopg.PGDialect_psycopg
, sqlalchemy.dialects.postgresql.psycopg2.PGDialect_psycopg2
, sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite
identifying name for the dialect's DBAPI
sqlalchemy.engine.default.DefaultDialect
a mapping of string keys that can be in an engine config linked to type conversion functions.
sqlalchemy.engine.default.DefaultDialect
set of DBAPI type objects that should be excluded in automatic cursor.setinputsizes() calls. This is only used if bind_typing is BindTyping.SET_INPUT_SIZES
either the 'tuple' or 'list' type, depending on what cursor.execute() accepts for the second argument (they vary).
sqlalchemy.engine.default.DefaultDialect
for backends that support both a lastrowid and a RETURNING insert strategy, favor RETURNING for simple single-int pk inserts. cursor.lastrowid tends to be more performant on most backends.
sqlalchemy.engine.default.DefaultDialect
Whether or not this dialect has a separate "terminate" implementation that does not block or require awaiting.
sqlalchemy.engine.default.DefaultDialect
This element will refer to an instance of :class:`.IdentifierPreparer` once a :class:`.DefaultDialect` has been constructed.
sqlalchemy.engine.default.DefaultDialect
set of DBAPI type objects that should be included in automatic cursor.setinputsizes() calls. This is only used if bind_typing is BindTyping.SET_INPUT_SIZES
sqlalchemy.engine.default.DefaultDialect
Indicates the dialect supports comment DDL that's inline with the definition of a Table or Column. If False, this implies that ALTER must be used to set table and column comments.
sqlalchemy.engine.default.DefaultDialect
dialect / driver / database supports some means of providing INSERT...RETURNING support when dialect.do_executemany() is used.
sqlalchemy.engine.default.DefaultDialect
if the dialect supports RETURNING with INSERT .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
Alternate to insertmanyvalues_page_size, will additionally limit page size based on number of parameters total in the statement.
sqlalchemy.engine.default.DefaultDialect
Number of rows to render into an individual INSERT..VALUES() statement for :attr:`.ExecuteStyle.INSERTMANYVALUES` executions. The default dialect defaults this to 1000. .. versionadded:: 2.0 .. seealso:: :paramref:`_engine.Connection.execution_options.insertmanyvalues_page_size` - execution option available on :class:`_engine.Connection`, statements
sqlalchemy.engine.default.DefaultDialect
Whether or not this dialect is intended for asyncio use.
sqlalchemy.engine.default.DefaultDialect
optional user-defined max length for SQL labels
sqlalchemy.engine.default.DefaultDialect
identifying name for the dialect from a DBAPI-neutral point of view (i.e. 'sqlite')
sqlalchemy.engine.default.DefaultDialect
the paramstyle to be used (some DB-APIs support multiple paramstyles).
sqlalchemy.engine.default.DefaultDialect
True if the paramstyle for this Dialect is positional.
sqlalchemy.engine.default.DefaultDialect
True if 'implicit' primary key functions must be executed separately in order to get their value, if RETURNING is not used. This is currently oriented towards PostgreSQL when the ``implicit_returning=False`` parameter is used on a :class:`.Table` object.
sqlalchemy.dialects.mysql.base.MySQLDialect
a :class:`.IdentifierPreparer` class used to quote identifiers.
sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
Sequence of string names indicating keyword arguments that can be established on a :class:`.Table` object which will be passed as "reflection options" when using :paramref:`.Table.autoload_with`. Current example is "oracle_resolve_synonyms" in the Oracle dialect.
sqlalchemy.engine.default.DefaultDialect
If True, indicates if the :paramref:`_schema.Sequence.optional` parameter on the :class:`_schema.Sequence` construct should signal to not generate a CREATE SEQUENCE. Applies only to dialects that support sequences. Currently used only to allow PostgreSQL SERIAL to be used on a column that specifies Sequence() for usage on other backends.
sqlalchemy.engine.default.DefaultDialect
deprecated; indicates if the dialect should attempt to use server side cursors by default
sqlalchemy.engine.default.DefaultDialect
a tuple containing a version number for the DB backend in use. This value is only available for supporting dialects, and is typically populated during the initial connection to the database.
sqlalchemy.engine.default.DefaultDialect
``True`` if the database supports ``ALTER TABLE`` - used only for generating foreign key constraints in certain circumstances
sqlalchemy.engine.default.DefaultDialect
Indicates the dialect supports comment DDL on tables and columns.
sqlalchemy.engine.default.DefaultDialect
Indicates if the dialect supports comment DDL on constraints. .. versionadded: 2.0
sqlalchemy.engine.default.DefaultDialect
dialect supports INSERT...(col) VALUES (DEFAULT) syntax. Most databases support this in some way, e.g. SQLite supports it using ``VALUES (NULL)``. MS SQL Server supports the syntax also however is the only included dialect where we have this disabled, as MSSQL does not support the field for the IDENTITY column, which is usually where we like to make use of the feature.
sqlalchemy.engine.default.DefaultDialect
dialect supports INSERT... DEFAULT VALUES syntax
sqlalchemy.engine.default.DefaultDialect
dialect supports INSERT () VALUES (), i.e. a plain INSERT with no columns in it. This is not usually supported; an "empty" insert is typically suited using either "INSERT..DEFAULT VALUES" or "INSERT ... (col) VALUES (DEFAULT)".
sqlalchemy.engine.default.DefaultDialect
Target database supports INSERT...VALUES with multiple value sets, i.e. INSERT INTO table (cols) VALUES (...), (...), (...), ...
sqlalchemy.engine.default.DefaultDialect
Indicates if the dialect supports a native boolean construct. This will prevent :class:`_types.Boolean` from generating a CHECK constraint when that type is used.
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.engine.default.DefaultDialect
indicates if Decimal objects are handled and returned for precision numeric types, or if floats are returned
sqlalchemy.engine.default.DefaultDialect
Indicates if the dialect supports a native ENUM construct. This will prevent :class:`_types.Enum` from generating a CHECK constraint when that type is used in "native" mode.
sqlalchemy.engine.default.DefaultDialect
indicates if Python UUID() objects are handled natively by the driver for SQL UUID datatypes. .. versionadded:: 2.0
sqlalchemy.connectors.pyodbc.PyODBCConnector
, sqlalchemy.engine.default.DefaultDialect
Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements when executed via executemany.
sqlalchemy.engine.default.DefaultDialect
Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements.
sqlalchemy.engine.default.DefaultDialect
Indicates if the dialect supports CREATE SEQUENCE or similar.
sqlalchemy.engine.default.DefaultDialect
indicates if the dialect supports server side cursors
sqlalchemy.engine.default.DefaultDialect
target database supports ORDER BY <labelname>, where <labelname> refers to a label in the columns clause of the SELECT
sqlalchemy.dialects.mssql.pyodbc.MSDialect_pyodbc
, sqlalchemy.dialects.mysql.pyodbc.MySQLDialect_pyodbc
, 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. .. versionadded:: 1.4.5 .. seealso:: :ref:`engine_thirdparty_caching`
sqlalchemy.engine.default.DefaultDialect
target database supports tuple IN, i.e. (x, y) IN ((q, p), (r, z))
sqlalchemy.engine.default.DefaultDialect
legacy; this is a TypeCompiler class at the class level, a TypeCompiler instance at the instance level. Refer to type_compiler_instance instead.
sqlalchemy.engine.default.DefaultDialect
instance of a :class:`.Compiled` class used to compile SQL type objects .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
dialect supports UPDATE..RETURNING with executemany.
sqlalchemy.engine.default.DefaultDialect
if the dialect supports RETURNING with UPDATE .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
if the dialect supports RETURNING with UPDATE..FROM .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
if True, indicates "insertmanyvalues" functionality should be used to allow for ``insert_executemany_returning`` behavior, if possible. In practice, setting this to True means: if ``supports_multivalues_insert``, ``insert_returning`` and ``use_insertmanyvalues`` are all True, the SQL compiler will produce an INSERT that will be interpreted by the :class:`.DefaultDialect` as an :attr:`.ExecuteStyle.INSERTMANYVALUES` execution that allows for INSERT of many rows with RETURNING by rewriting a single-row INSERT statement to have multiple VALUES clauses, also executing the statement multiple times for a series of batches when large numbers of rows are given. The parameter is False for the default dialect, and is set to True for SQLAlchemy internal dialects SQLite, MySQL/MariaDB, PostgreSQL, SQL Server. It remains at False for Oracle, which provides native "executemany with RETURNING" support and also does not support ``supports_multivalues_insert``. For MySQL/MariaDB, those MySQL dialects that don't support RETURNING will not report ``insert_executemany_returning`` as True. .. versionadded:: 2.0 .. seealso:: :ref:`engine_insertmanyvalues`
sqlalchemy.engine.default.DefaultDialect
if True, and use_insertmanyvalues is also True, INSERT statements that don't include RETURNING will also use "insertmanyvalues". .. versionadded:: 2.0
sqlalchemy.engine.default.DefaultDialect
same as .dbapi, but is never None; will raise an error if no DBAPI was set up. .. versionadded:: 2.0
DBAPIConnection
, level: IsolationLevel
):
(source)
¶
sqlalchemy.engine.default.DefaultDialect
Undocumented
DBAPICursor
, statement: str
, parameters: _DBAPIMultiExecuteParams
, generic_setinputsizes: Optional[ _GenericSetInputSizesType]
, context: ExecutionContext
) -> Iterator[ Tuple[ str, _DBAPISingleExecuteParams, _GenericSetInputSizesType, int, int]]
:
(source)
¶
sqlalchemy.engine.default.DefaultDialect
convert executemany parameters for an INSERT into an iterator of statement/single execute values, used by the insertmanyvalues feature.
sqlalchemy.dialects.mssql.base.MSDialect
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.base.OracleDialect
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.base.SQLiteDialect
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.connectors.pyodbc.PyODBCConnector
, sqlalchemy.dialects.mssql.pymssql.MSDialect_pymssql
, sqlalchemy.dialects.mssql.pyodbc.MSDialect_pyodbc
, sqlalchemy.dialects.mysql.base.MySQLDialect
, sqlalchemy.dialects.oracle.cx_oracle.OracleDialect_cx_oracle
, sqlalchemy.dialects.postgresql.base.PGDialect
, sqlalchemy.dialects.sqlite.pysqlite.SQLiteDialect_pysqlite
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
internal evaluation for supports_statement_cache