sqlcompyre.analysis.dialects.mssql module

class sqlcompyre.analysis.dialects.mssql.MssqlDialect(fast_executemany=False, use_setinputsizes=True, **params)[source]

Bases: MSDialect_pyodbc, DialectProtocol

Dialect for Microsoft SQL Server.

Attributes:
default_schema_name
dialect_description
exclude_set_input_sizes
full_returning

Deprecated since version 2.0: full_returning is deprecated, please use insert_returning, update_returning, delete_returning

include_set_input_sizes
isolation_level
max_constraint_name_length
max_index_name_length
pyodbc_driver_name

Methods

connect(*cargs, **cparams)

Establish a connection using this dialect's DBAPI.

create_connect_args(url)

Build DB-API compatible connection arguments.

create_xid()

Create a random two-phase transaction ID.

denormalize_name(name)

convert the given name to a case insensitive identifier for the backend if it is an all-lowercase name.

do_begin(dbapi_connection)

Provide an implementation of connection.begin(), given a DB-API connection.

do_begin_twophase(connection, xid)

Begin a two phase transaction on the given connection.

do_close(dbapi_connection)

Provide an implementation of connection.close(), given a DBAPI connection.

do_commit(dbapi_connection)

Provide an implementation of connection.commit(), given a DB-API connection.

do_commit_twophase(connection, xid[, ...])

Commit a two phase transaction on the given connection.

do_execute(cursor, statement, parameters[, ...])

Provide an implementation of cursor.execute(statement, parameters).

do_execute_no_params(cursor, statement[, ...])

Provide an implementation of cursor.execute(statement).

do_executemany(cursor, statement, parameters)

Provide an implementation of cursor.executemany(statement, parameters).

do_ping(dbapi_connection)

ping the DBAPI connection and return True if the connection is usable.

do_prepare_twophase(connection, xid)

Prepare a two phase transaction on the given connection.

do_recover_twophase(connection)

Recover list of uncommitted prepared two phase transaction identifiers on the given connection.

do_release_savepoint(connection, name)

Release the named savepoint on a connection.

do_rollback(dbapi_connection)

Provide an implementation of connection.rollback(), given a DB-API connection.

do_rollback_to_savepoint(connection, name)

Rollback a connection to the named savepoint.

do_rollback_twophase(connection, xid[, ...])

Rollback a two phase transaction on the given connection.

do_savepoint(connection, name)

Create a savepoint with the given name.

do_set_input_sizes(cursor, list_of_tuples, ...)

invoke the cursor.setinputsizes() method with appropriate arguments

do_terminate(dbapi_connection)

Provide an implementation of connection.close() that tries as much as possible to not block, given a DBAPI connection.

engine_created(engine)

A convenience hook called before returning the final _engine.Engine.

execute_sequence_format

alias of tuple

get_async_dialect_cls(url)

Given a URL, return the Dialect that will be used by an async engine.

get_check_constraints(connection, table_name)

Return information about check constraints in table_name.

get_columns(connection, tablename, dbname, ...)

Return information about columns in table_name.

get_default_isolation_level(dbapi_conn)

Given a DBAPI connection, return its isolation level, or a default isolation level if one cannot be retrieved.

get_dialect_cls(url)

Given a URL, return the Dialect that will be used.

get_dialect_pool_class(url)

return a Pool class to use for a given URL

get_driver_connection(connection)

Returns the connection object as returned by the external driver package.

get_foreign_keys(connection, tablename, ...)

Return information about foreign_keys in table_name.

get_indexes(connection, tablename, dbname, ...)

Return information about indexes in table_name.

get_isolation_level(dbapi_connection)

Given a DBAPI connection, return its isolation level.

get_isolation_level_values(dbapi_connection)

return a sequence of string isolation level names that are accepted by this dialect.

get_materialized_view_names(connection[, schema])

Return a list of all materialized view names available in the database.

get_multi_check_constraints(connection, **kw)

Return information about check constraints in all tables in the given schema.

get_multi_columns(connection, **kw)

Return information about columns in all tables in the given schema.

get_multi_foreign_keys(connection, **kw)

Return information about foreign_keys in all tables in the given schema.

get_multi_indexes(connection, **kw)

Return information about indexes in in all tables in the given schema.

get_multi_pk_constraint(connection, **kw)

Return information about primary key constraints in all tables in the given schema.

get_multi_table_comment(connection, **kw)

Return information about the table comment in all tables in the given schema.

get_multi_table_options(connection, **kw)

Return a dictionary of options specified when the tables in the given schema were created.

get_multi_unique_constraints(connection, **kw)

Return information about unique constraints in all tables in the given schema.

get_pk_constraint(connection, tablename, ...)

Return information about the primary key constraint on table_name`.

get_schema_names(connection, **kw)

Return a list of all schema names available in the database.

get_sequence_names(connection, dbname, ...)

Return a list of all sequence names available in the database.

get_table_comment(connection, table_name[, ...])

Return the "comment" for the table identified by table_name.

get_table_creation_timestamps(engine, tables)

Obtain the creation timestamps from a list of tables.

get_table_names(connection, dbname, owner, ...)

Return a list of table names for schema.

get_table_options(connection, table_name[, ...])

Return a dictionary of options specified when table_name was created.

get_temp_table_names(connection[, schema])

Return a list of temporary table names on the given connection, if supported by the underlying backend.

get_temp_view_names(connection[, schema])

Return a list of temporary view names on the given connection, if supported by the underlying backend.

get_unique_constraints(connection, table_name)

Return information about unique constraints in table_name.

get_view_definition(connection, viewname, ...)

Return plain or materialized view definition.

get_view_names(connection, dbname, owner, ...)

Return a list of all non-materialized view names available in the database.

has_index(connection, table_name, index_name)

Check the existence of a particular index name in the database.

has_schema(connection, schema_name, **kw)

Check the existence of a particular schema name in the database.

has_sequence(connection, sequencename, ...)

Check the existence of a particular sequence in the database.

has_table(connection, tablename, dbname, ...)

For internal dialect use, check the existence of a particular table or view in the database.

import_dbapi()

Import the DBAPI module that is used by this dialect.

initialize(connection)

Called during strategized creation of the dialect with a connection.

is_disconnect(e, connection, cursor)

Return True if the given DB-API error indicates an invalid connection

load_provisioning()

set up the provision.py module for this dialect.

normalize_name(name)

convert the given name to lowercase if it is detected as case insensitive.

on_connect()

return a callable which sets up a newly created DBAPI connection.

on_connect_url(url)

return a callable which sets up a newly created DBAPI connection.

reset_isolation_level(dbapi_conn)

Given a DBAPI connection, revert its isolation to the default.

set_connection_execution_options(connection, ...)

Establish execution options for a given connection.

set_engine_execution_options(engine, opts)

Establish execution options for a given engine.

set_isolation_level(dbapi_connection, level)

Given a DBAPI connection, set its isolation level.

type_descriptor(typeobj)

Provide a database-specific TypeEngine object, given the generic object which comes from the types module.

ddl_compiler

execution_ctx_cls

get_pool_class

preparer

statement_compiler

type_compiler_cls

validate_identifier

case_insensitive_collation: str = 'SQL_Latin1_General_CP1_CI_AS'

Case-insensitive collation to use for string comparisons.

case_sensitive_collation: str = 'Latin1_General_CS_AS'

Case-sensitive collation to use for string comparisons.

get_table_creation_timestamps(engine: Engine, tables: list[Table]) list[datetime][source]

Obtain the creation timestamps from a list of tables.

Args:
engine: The engine to use for connecting to the database and querying creation

timestamps.

tables: The list of tables to query the creation dates for.

Returns:

The creation timestamps of the tables given to this method, ordered in the same way as the input.

name: str = 'mssql'

identifying name for the dialect from a DBAPI-neutral point of view (i.e. ‘sqlite’)

supports_multi_part_schemas: bool = True

Whether the database supports multi-part schemas, i.e. queries across databases.

supports_schemas: bool = True

Whether the database has a concept of schemas.

supports_statement_cache: bool = False

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.

Added in version 1.4.5.

See also

engine_thirdparty_caching

verbose_name: str = 'Microsoft SQL Server'

The common name of the dialect.

views_support_notnull_columns: bool = True

Whether views have a notion of NOT NULL columns.