class PGDialect_psycopg2(_PGDialect_common_psycopg): (source)
Known subclasses: sqlalchemy.dialects.postgresql.psycopg2cffi.PGDialect_psycopg2cffi
Undocumented
Class Method | import |
Import the DBAPI module that is used by this dialect. |
Method | __init__ |
Undocumented |
Method | do |
Begin a two phase transaction on the given connection. |
Method | do |
Commit a two phase transaction on the given connection. |
Method | do |
Provide an implementation of ``cursor.executemany(statement, parameters)``. |
Method | do |
Prepare a two phase transaction on the given connection. |
Method | do |
Rollback a two phase transaction on the given connection. |
Method | get |
Undocumented |
Method | get |
Undocumented |
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 | on |
return a callable which sets up a newly created DBAPI connection. |
Method | set |
Undocumented |
Method | set |
Given a DBAPI connection, set its isolation level. |
Method | set |
Undocumented |
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 | default |
Undocumented |
Class Variable | driver |
identifying name for the dialect's DBAPI |
Class Variable | supports |
indicates if the dialect supports server side cursors |
Class Variable | supports |
indicates if this dialect supports caching. |
Class Variable | use |
if True, and use_insertmanyvalues is also True, INSERT statements that don't include RETURNING will also use "insertmanyvalues". |
Instance Variable | executemany |
Undocumented |
Instance Variable | executemany |
Undocumented |
Instance Variable | psycopg2 |
Undocumented |
Instance Variable | supports |
Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements when executed via executemany. |
Method | _do |
Undocumented |
Method | _hstore |
Undocumented |
Instance Variable | _has |
Undocumented |
Property | _isolation |
Undocumented |
Property | _psycopg2 |
Undocumented |
Property | _psycopg2 |
Undocumented |
Inherited from _PGDialect_common_psycopg
:
Method | create |
Build DB-API compatible connection arguments. |
Method | do |
ping the DBAPI connection and return True if the connection is usable. |
Method | get |
return a sequence of string isolation level names that are accepted by this dialect. |
Instance Variable | client |
Undocumented |
Instance Variable | use |
Undocumented |
Method | _do |
Undocumented |
Inherited from PGDialect
(via _PGDialect_common_psycopg
):
Method | do |
Recover list of uncommitted prepared two phase transaction identifiers on the given connection. |
Method | get |
Return information about check constraints in ``table_name``. |
Method | get |
Return information about columns in ``table_name``. |
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 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 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 |
Fetch the oid for schema.table_name. |
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 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 | has |
Undocumented |
Class Variable | connection |
Undocumented |
Class Variable | construct |
Optional set of argument specifiers for various SQLAlchemy constructs, typically schema items. |
Class Variable | delete |
if the dialect supports RETURNING with DELETE |
Class Variable | delete |
if the dialect supports RETURNING with DELETE..FROM |
Class Variable | insert |
if the dialect supports RETURNING with INSERT |
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 | postfetch |
Undocumented |
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 | 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 | 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... VALUES (DEFAULT) syntax |
Class Variable | supports |
dialect supports INSERT... DEFAULT VALUES syntax |
Class Variable | supports |
dialect supports INSERT () VALUES () |
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 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. |
Class Variable | supports |
Indicates if the dialect supports CREATE SEQUENCE or similar. |
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. |
Instance Variable | supports |
target database supports IDENTITY |
Instance Variable | supports |
Undocumented |
Method | _check |
Undocumented |
Method | _columns |
Undocumented |
Method | _comment |
Undocumented |
Method | _domain |
Undocumented |
Method | _enum |
Undocumented |
Method | _foreing |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Return the string name of the currently selected schema from the given connection. |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Retrieve the server version info from the given connection. |
Method | _get |
Undocumented |
Method | _has |
Undocumented |
Method | _kind |
Undocumented |
Method | _load |
Undocumented |
Method | _load |
Undocumented |
Method | _pg |
Undocumented |
Method | _pg |
Undocumented |
Method | _pg |
Undocumented |
Method | _prepare |
Undocumented |
Method | _reflect |
Undocumented |
Method | _table |
Undocumented |
Method | _value |
Undocumented |
Class Variable | _supports |
Undocumented |
Instance Variable | _backslash |
Undocumented |
Instance Variable | _json |
Undocumented |
Instance Variable | _json |
Undocumented |
Instance Variable | _supports |
Undocumented |
Property | _constraint |
Undocumented |
Property | _fk |
Undocumented |
Property | _index |
Undocumented |
Inherited from DefaultDialect
(via _PGDialect_common_psycopg
, PGDialect
):
Class Method | get |
Undocumented |
Class Method | load |
set up the provision.py module for this dialect. |
Method | connect |
Establish a connection using this dialect's DBAPI. |
Method | create |
Create a random 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 |
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 |
Provide an implementation of ``cursor.execute(statement, parameters)``. |
Method | do |
Provide an implementation of ``cursor.execute(statement)``. |
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 |
Create a savepoint with the given name. |
Method | do |
Provide an implementation of ``connection.close()`` that tries as much as possible to not block, given a DBAPI connection. |
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 a dictionary of options specified when the tables in the given schema were created. |
Method | has |
Check the existence of a particular index name in the database. |
Method | normalize |
convert the given name to lowercase if it is detected as case insensitive. |
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 | type |
Provide a database-specific :class:`.TypeEngine` object, given the generic object which comes from the types module. |
Method | validate |
Undocumented |
Class Variable | cte |
target database, when given a CTE with an INSERT statement, needs the CTE to be below the INSERT |
Class Variable | default |
for INSERT... VALUES (DEFAULT) syntax, the token to put in the parenthesis. |
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 | div |
target database treats the / division operator as "floor division" |
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 | 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 | 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 |
Undocumented |
Class Variable | insertmanyvalues |
Alternate to insertmanyvalues_page_size, will additionally limit page size based on number of parameters total in the statement. |
Class Variable | is |
Whether or not this dialect is intended for asyncio use. |
Class Variable | isolation |
Undocumented |
Class Variable | max |
Undocumented |
Class Variable | max |
Undocumented |
Class Variable | non |
Undocumented |
Class Variable | requires |
Undocumented |
Class Variable | server |
deprecated; indicates if the dialect should attempt to use server side cursors by default |
Class Variable | supports |
Undocumented |
Class Variable | supports |
Undocumented |
Class Variable | supports |
indicates if Decimal objects are handled and returned for precision numeric types, or if floats are returned |
Class Variable | supports |
Undocumented |
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 |
Undocumented |
Class Variable | tuple |
target database supports tuple IN, i.e. (x, y) IN ((q, p), (r, z)) |
Class Variable | update |
dialect supports UPDATE..RETURNING with executemany. |
Instance Variable | bind |
Undocumented |
Instance Variable | compiler |
Undocumented |
Instance Variable | dbapi |
A reference to the DBAPI module object itself. |
Instance Variable | default |
the isolation that is implicitly present on new connections |
Instance 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. |
Instance Variable | identifier |
This element will refer to an instance of :class:`.IdentifierPreparer` once a :class:`.DefaultDialect` has been constructed. |
Instance Variable | insertmanyvalues |
Number of rows to render into an individual INSERT..VALUES() statement for :attr:`.ExecuteStyle.INSERTMANYVALUES` executions. |
Instance Variable | label |
optional user-defined max length for SQL labels |
Instance Variable | paramstyle |
the paramstyle to be used (some DB-APIs support multiple paramstyles). |
Instance Variable | positional |
True if the paramstyle for this Dialect is positional. |
Instance Variable | server |
a tuple containing a version number for the DB backend in use. |
Instance Variable | type |
legacy; this is a TypeCompiler class at the class level, a TypeCompiler instance at the instance level. |
Instance Variable | type |
instance of a :class:`.Compiled` class used to compile SQL type objects |
Property | dialect |
Undocumented |
Property | full |
Undocumented |
Property | insert |
dialect / driver / database supports some means of providing INSERT...RETURNING support when dialect.do_executemany() is used. |
Property | loaded |
same as .dbapi, but is never None; will raise an error if no DBAPI was set up. |
Property | supports |
True if this dialect supports sane rowcount even if RETURNING is in use. |
Method | _assert |
Undocumented |
Method | _builtin |
Undocumented |
Method | _check |
Perform a connection / server version specific check to determine the max_identifier_length. |
Method | _default |
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 | _ensure |
Undocumented |
Method | _gen |
Undocumented |
Method | _overrides |
Undocumented |
Method | _reset |
Undocumented |
Method | _set |
Undocumented |
Class Variable | _legacy |
Undocumented |
Instance Variable | _ischema |
Undocumented |
Instance Variable | _on |
Undocumented |
Instance Variable | _user |
Undocumented |
Property | _bind |
Undocumented |
Property | _dialect |
Undocumented |
Property | _supports |
internal evaluation for supports_statement_cache |
Property | _type |
Undocumented |
Inherited from Dialect
(via _PGDialect_common_psycopg
, PGDialect
, DefaultDialect
):
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. |
Method | do |
invoke the cursor.setinputsizes() method with appropriate arguments |
Method | get |
Return a dictionary of options specified when ``table_name`` was created. |
Method | on |
return a callable which sets up a newly created DBAPI connection. |
Class Variable | ddl |
a :class:`.Compiled` class used to compile DDL statements |
Class Variable | dispatch |
Undocumented |
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 | preparer |
a :class:`.IdentifierPreparer` class used to quote identifiers. |
Class Variable | statement |
a :class:`.Compiled` class used to compile SQL statements |
Class Variable | type |
a :class:`.Compiled` class used to compile SQL type objects |
Class Variable | _has |
Undocumented |
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.
Undocumented
Begin a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid
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.
Prepare a two phase transaction on the given connection. :param connection: a :class:`_engine.Connection`. :param xid: xid
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.
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.
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.
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
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.
sqlalchemy.dialects.postgresql._psycopg_common._PGDialect_common_psycopg.default_paramstyle
Undocumented
sqlalchemy.dialects.postgresql._psycopg_common._PGDialect_common_psycopg.supports_statement_cache
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`
if True, and use_insertmanyvalues is also True, INSERT statements that don't include RETURNING will also use "insertmanyvalues". .. versionadded:: 2.0
Indicate whether the dialect properly implements rowcount for ``UPDATE`` and ``DELETE`` statements when executed via executemany.
sqlalchemy.dialects.postgresql._psycopg_common._PGDialect_common_psycopg._has_native_hstore
Undocumented