Wordsmith on connection.set_session()

Fixes #310.
This commit is contained in:
Daniele Varrazzo 2015-05-03 09:42:32 +01:00
parent a24597d0e0
commit b2734c2cbd

View File

@ -351,17 +351,14 @@ The ``connection`` class
.. method:: set_session(isolation_level=None, readonly=None, deferrable=None, autocommit=None) .. method:: set_session(isolation_level=None, readonly=None, deferrable=None, autocommit=None)
Set one or more parameters for the next transactions or statements in Set one or more parameters for the next transactions or statements in
the current session. See |SET TRANSACTION|_ for further details. the current session.
.. |SET TRANSACTION| replace:: :sql:`SET TRANSACTION`
.. _SET TRANSACTION: http://www.postgresql.org/docs/current/static/sql-set-transaction.html
:param isolation_level: set the `isolation level`_ for the next :param isolation_level: set the `isolation level`_ for the next
transactions/statements. The value can be one of the transactions/statements. The value can be one of the literal
:ref:`constants <isolation-level-constants>` defined in the values ``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE
`~psycopg2.extensions` module or one of the literal values READ``, ``SERIALIZABLE`` or the equivalent :ref:`constant
``READ UNCOMMITTED``, ``READ COMMITTED``, ``REPEATABLE READ``, <isolation-level-constants>` defined in the `~psycopg2.extensions`
``SERIALIZABLE``. module.
:param readonly: if `!True`, set the connection to read only; :param readonly: if `!True`, set the connection to read only;
read/write if `!False`. read/write if `!False`.
:param deferrable: if `!True`, set the connection to deferrable; :param deferrable: if `!True`, set the connection to deferrable;
@ -370,19 +367,14 @@ The ``connection`` class
PostgreSQL session setting but an alias for setting the PostgreSQL session setting but an alias for setting the
`autocommit` attribute. `autocommit` attribute.
Parameter passed as `!None` (the default for all) will not be changed.
The parameters *isolation_level*, *readonly* and *deferrable* also
accept the string ``DEFAULT`` as a value: the effect is to reset the
parameter to the server default.
.. _isolation level: .. _isolation level:
http://www.postgresql.org/docs/current/static/transaction-iso.html http://www.postgresql.org/docs/current/static/transaction-iso.html
The function must be invoked with no transaction in progress. At every Arguments set to `!None` (the default for all) will not be changed.
function invocation, only the specified parameters are changed. The parameters *isolation_level*, *readonly* and *deferrable* also
accept the string ``DEFAULT`` as a value: the effect is to reset the
The default for the values are defined by the server configuration: parameter to the server default. Defaults are defined by the server
see values for |default_transaction_isolation|__, configuration: see values for |default_transaction_isolation|__,
|default_transaction_read_only|__, |default_transaction_deferrable|__. |default_transaction_read_only|__, |default_transaction_deferrable|__.
.. |default_transaction_isolation| replace:: :sql:`default_transaction_isolation` .. |default_transaction_isolation| replace:: :sql:`default_transaction_isolation`
@ -392,12 +384,20 @@ The ``connection`` class
.. |default_transaction_deferrable| replace:: :sql:`default_transaction_deferrable` .. |default_transaction_deferrable| replace:: :sql:`default_transaction_deferrable`
.. __: http://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-DEFERRABLE .. __: http://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-DEFAULT-TRANSACTION-DEFERRABLE
The function must be invoked with no transaction in progress.
.. note:: .. note::
There is currently no builtin method to read the current value for There is currently no builtin method to read the current value for
the parameters: use :sql:`SHOW default_transaction_...` to read the parameters: use :sql:`SHOW default_transaction_...` to read
the values from the backend. the values from the backend.
.. seealso:: |SET TRANSACTION|_ for further details about the behaviour
of the transaction parameters in the server.
.. |SET TRANSACTION| replace:: :sql:`SET TRANSACTION`
.. _SET TRANSACTION: http://www.postgresql.org/docs/current/static/sql-set-transaction.html
.. versionadded:: 2.4.2 .. versionadded:: 2.4.2