diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2015-06-02 17:02:04 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2015-06-02 17:02:04 +0100 |
commit | 1f330e9cac9c5d40c33f4f58d0dbfc0109c62edc (patch) | |
tree | 0e4d67997ee734ac3025774a163c031e8a217b7b /doc/src/connection.rst | |
parent | 2ad82b973b86fa71126657aacee89a30d2211894 (diff) | |
download | psycopg2-1f330e9cac9c5d40c33f4f58d0dbfc0109c62edc.tar.gz |
Allow connection.notices and notifies to be replaced.
Close #326
Diffstat (limited to 'doc/src/connection.rst')
-rw-r--r-- | doc/src/connection.rst | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/doc/src/connection.rst b/doc/src/connection.rst index 92178f3..cceef1e 100644 --- a/doc/src/connection.rst +++ b/doc/src/connection.rst @@ -483,13 +483,21 @@ The ``connection`` class ['NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"\n', 'NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq" for serial column "foo.id"\n'] + .. versionchanged:: 2.7 + The `!notices` attribute is writable: the user may replace it + with any Python object exposing an `!append()` method. If + appending raises an exception the notice is silently + dropped. + To avoid a leak in case excessive notices are generated, only the last - 50 messages are kept. + 50 messages are kept. This check is only in place if the `!notices` + attribute is a list: if any other object is used it will be up to the + user to guard from leakage. You can configure what messages to receive using `PostgreSQL logging configuration parameters`__ such as ``log_statement``, ``client_min_messages``, ``log_min_duration_statement`` etc. - + .. __: http://www.postgresql.org/docs/current/static/runtime-config-logging.html @@ -506,6 +514,12 @@ The ``connection`` class the payload was not accessible. To keep backward compatibility, `!Notify` objects can still be accessed as 2 items tuples. + .. versionchanged:: 2.7 + The `!notifies` attribute is writable: the user may replace it + with any Python object exposing an `!append()` method. If + appending raises an exception the notification is silently + dropped. + .. attribute:: cursor_factory |