Commit Graph

536 Commits

Author SHA1 Message Date
Alexander Kukushkin
5eec11f232 Improve docs 2019-05-06 15:42:37 +02:00
Alexander Kukushkin
f827e49f55 Change the default value of keepalive_interval parameter to None
The previous default value was 10 seconds, what might cause silent
overwrite of the *status_interval* specified in the `start_replication()`
2019-05-06 15:26:21 +02:00
Alexander Kukushkin
6cff5a3e08 Smart replication feedback
This commit makes psycopg2 responsible for sending the status update
(feedback) messages to the server regardless of whether a synchronous or
asynchronous connection is used.

Feedback is sent every *status_update* (default value is 10) seconds,
which could be configured by passing a corresponding parameter to the
`start_replication()` or `start_replication_expert()` methods.
The actual feedback message is sent by the
`pq_read_replication_message()` when the *status_update* timeout is
reached.

The default behavior of the `send_feedback()` method is changed.
It doesn't send a feedback message on every call anymore but just
updates internal structures. There is still a way to *force* sending
a message if *force* or *reply* parameters are set.

The new approach has certain advantages:
1. The client can simply call the `send_feedback()` for every
   processed message and the library will take care of not overwhelming
   the server. Actually, in the synchronous mode it is even mandatory
   to confirm every processed message.
2. The library tracks internally the pointer of the last received
   message which is not keepalive. If the client confirmed the last
   message and after that server sends only keepalives with increasing
   *wal_end*, the library can safely move forward *flush* position to
   the *wal_end* and later automatically report it to the server.

Reporting of the *wal_end* received from keepalive messages is very
important. Not doing so casing:
1. Excessive disk usage, because the replication slot prevents from
   WAL being cleaned up.
2. The smart and fast shutdown of the server could last indefinitely
   because walsender waits until the client report *flush* position
   equal to the *wal_end*.

This implementation is only extending the existing API and therefore
should not break any of the existing code.
2019-05-06 10:27:44 +02:00
Daniele Varrazzo
6b740df704 Added FAQ entry about the change in binary packages in 2.8 2019-04-14 15:08:07 +01:00
Daniele Varrazzo
5e01c47818 Highlight in docs that the context manager doesn't close the connection
Code as in #889 is not robust, but the behaviour is actually
counter-intuitive.
2019-04-07 11:19:56 +01:00
Daniele Varrazzo
544e157649 Fixed replication cursor docs warning indentation level 2019-04-01 10:54:01 +01:00
Daniele Varrazzo
ed74189acd Replication objects docs header level bumped up
Now it appears in the ToCs.
2019-04-01 10:40:44 +01:00
Daniele Varrazzo
813ca30953 Fixed notice about new wal_end attribute being on the cursor 2019-04-01 10:40:06 +01:00
Daniele Varrazzo
b8bf6d9917 Added news entry about ReplicationMessage.wal_end 2019-03-30 21:23:20 +00:00
grunskis-bonial
ff91ad5186 Address code review feedback 2019-03-30 21:23:13 +00:00
Martins Grunskis
f946042a79 Store WAL end pointer in the replication cursor 2019-03-30 21:23:11 +00:00
Andrew Rabert
3eecf34bea Add time type conversion info to docs 2019-03-24 23:09:36 +00:00
Jon Dufresne
03bb44dd2c Convert while 1: statements to while True:
A slightly more readable and modern syntax.
2019-03-13 11:13:05 +00:00
Daniele Varrazzo
3ae9dfd545 Better link from docs to "json and jsonb" data types 2019-03-05 17:31:45 +00:00
Daniele Varrazzo
a68df50c7b Added ConnectionInfo.dsn_parameters attribute 2019-02-17 02:37:09 +00:00
Daniele Varrazzo
0eb4560771 Don't use versions such as 2.8.0 in docs
Use 2.8.
2019-02-17 01:51:06 +00:00
Daniele Varrazzo
599432552a Copyright year updated
ag -l Copyright | xargs sed -i \
        "s/\(.*copyright (C) [0-9]\+\)\(-[0-9]\+\)\?\(.*\)/\1-$(date +%Y)\3/I"
2019-02-17 01:36:36 +00:00
Daniele Varrazzo
d177fa9bd0 Allow building docs with Python 3
Use a .pth file to simplify finding the just-built psycopg package into the
docs building env.
2019-02-17 01:36:36 +00:00
Daniele Varrazzo
63ce5ca94f Fixed title level of sqlsate errors table in docs 2019-02-17 01:07:47 +00:00
Daniele Varrazzo
f70d6fd0ed Dropped text docs generation 2019-02-17 00:58:27 +00:00
Daniele Varrazzo
e5e8cec350 Added table of sqlstate exceptions in the docs
Note that the column-spanning cells break text docs. I don't think
anybody cares about them, so going to drop them.
2019-02-17 01:55:14 +01:00
Daniele Varrazzo
80b7b845d2 Added docs about pgconn_ptr, pgresult_ptr 2019-02-16 18:12:52 +01:00
Daniele Varrazzo
7c148ecee4 Improvements to errors module docs 2019-02-11 01:20:21 +00:00
Daniele Varrazzo
4298718978 Dropped PSYCOPG_DISPLAY_SIZE build parameter
Big and complex _pq_fetch_tuples simplified by moving per-column
calculation to a separate function.
2019-01-25 17:31:39 +00:00
Daniele Varrazzo
49777de74c Added documentation for BYTES caster 2019-01-18 16:15:15 +00:00
Daniele Varrazzo
4a41c9a8cc
Merge pull request #828 from wbolster/patch-1
mention postgresql 11 in install docs
2019-01-08 12:21:18 +00:00
Daniele Varrazzo
f3695e36c7 Merge remote-tracking branch 'eternalflow/execute-values-returning-clause-support' 2018-12-27 14:53:12 +01:00
Daniele Varrazzo
bde9fc6dea Docs wordsmith for execute_values() fetch param 2018-12-27 14:42:58 +01:00
wouter bolsterlee
107f779061
mention postgresql 11 in install docs 2018-12-07 15:10:18 +01:00
Jon Dufresne
a1fdaebc30 Dropped deprecated PersistentConnectionPool
This class was deprecated in
27cd6c4880 (Dec 2, 2012), which was first
included in release 2.5. Enough time has passed for library uses to find
an alternative solution.

This class was untested.
2018-12-04 06:32:00 -08:00
Ivan Kotelnikov
2e591e27f2 add versionchanged to docs 2018-11-24 20:51:18 +02:00
Federico Di Gregorio
01f8475f53
Merge branch 'master' into feature-expose-pgconn 2018-11-07 14:15:29 +01:00
Daniele Varrazzo
0236c68da9 Merge branch 'connection-info' 2018-10-15 01:24:00 +01:00
Daniele Varrazzo
b205764fdd Merge branch 'master' into errors-module 2018-10-15 00:58:32 +01:00
Daniele Varrazzo
e7227ce87b Added errors.lookup() function 2018-10-15 00:56:51 +01:00
Daniele Varrazzo
5da968d6f6 Added documentation for the errors module 2018-10-15 00:48:44 +01:00
Daniele Varrazzo
7a5edff6c6 errorcodes map update to PostgreSQL 11 2018-10-14 22:57:48 +01:00
Daniele Varrazzo
44bd2927c5 Use the connection.info properties instead of the legacy methods 2018-10-13 03:28:42 +01:00
Daniele Varrazzo
d138e42ee5 Added ConnectionInfo.parameter_status() 2018-10-13 02:40:17 +01:00
Daniele Varrazzo
9f6a3a5e96 Added ConnectionInfo.ssl_attribute() 2018-10-13 02:21:38 +01:00
Daniele Varrazzo
cb3d5f9d92 Added all the missing ConnectionInfo attributes 2018-10-13 01:36:07 +01:00
Daniele Varrazzo
4f7bbdca26 Added missing class signatures in the docs 2018-10-13 00:55:20 +01:00
Daniele Varrazzo
439dff974d Added ConnectionInfo.error_message 2018-10-13 00:47:04 +01:00
Daniele Varrazzo
1ac6359fef Added other members to the ConnectionInfo class
Starting deprecating softly some of the methods bloating the connection
class.
2018-10-12 04:18:59 +01:00
Daniele Varrazzo
0a04c8892d Added several ConnectionInfo attributes 2018-10-12 04:18:59 +01:00
Daniele Varrazzo
9ddf59959f Adding ConnectionInfo object documentation
I'm still fought whether docs should be in the C module or in the .rst.
I'd prefer the first because DRY, but writing multiline strings in C
really sucks.
2018-10-12 03:25:06 +01:00
Daniele Varrazzo
6b3d3604bf Added docs for the Column object 2018-10-11 04:27:42 +01:00
Daniele Varrazzo
5010a65d77 Another url changed to https
Added after this MR.
2018-10-10 22:15:45 +01:00
Daniele Varrazzo
9148157697 Merge branch 'master' into https 2018-10-10 22:07:33 +01:00
Daniele Varrazzo
cd9d74c462 Merge branch 'conn-get-host' 2018-10-10 22:03:36 +01:00
Daniele Varrazzo
382eeccab8 Small tweaks to connection.host docs 2018-10-10 22:02:20 +01:00
Daniele Varrazzo
f5f6b420b2 Merge remote-tracking branch 'origin/diag-schema-name-nonloc' 2018-10-10 21:46:51 +01:00
Alan D Moore
20647b7bcc Fix RST markup 2018-10-08 09:40:51 -05:00
Alan D Moore
67b94d0797 Added note about backslashes and LIKE
Added note about the use of LIKE with strings containing
backslashes.  Addresses concern in issue #785.
2018-10-08 09:36:16 -05:00
Federico Di Gregorio
f56392a245 Allow SPHINXBUILD on command line 2018-10-07 13:55:11 +02:00
Federico Di Gregorio
81addddaee Added connection.get_native_connection() 2018-10-07 13:54:24 +02:00
Marco De Paoli
1c553bb703 Added connection.host
Return the server host name of the current connect.
2018-10-06 15:19:01 +02:00
Daniele Varrazzo
4e0b2ec9c9 Added Diagnostics.severity_nonlocalized attribute
Close #783.
2018-10-04 16:13:46 +01:00
Daniele Varrazzo
4aa02b7855 sql.Identifier can wrap a sequence of strings to represent qualified names
Close #732.
2018-10-04 12:46:10 +01:00
Jon Dufresne
b07e34e0b8 Prefer https:// URLs when available 2018-09-22 19:02:33 -07:00
Andrew King
03fc3f9a2a Fix typo in install.rst 2018-09-05 16:42:59 +01:00
Jon Dufresne
c57fee2c92 Update intersphinx URLs to point to Python 3 docs
Python 3 docs are more up to date and reflect the future of Python.

Removed unused py3 marker.
2018-09-05 16:21:14 +01:00
Jon Dufresne
61e644049f Add testing and document support for Python 3.7
Python 3.7 was released on June 27, 2018.

https://docs.python.org/3/whatsnew/3.7.html
2018-07-12 18:07:25 -07:00
Daniele Varrazzo
0aa7e21f91 Added note adivising against depending on the -wheels package 2018-05-23 21:43:48 +01:00
Daniele Varrazzo
9e4f89a2a1 encrypt_password docs moved to extension module and updated 2018-05-20 20:13:04 +01:00
Daniele Varrazzo
0161d54dbb Merge branch 'master' into encrypt-pass 2018-05-20 17:57:34 +01:00
Jon Dufresne
9ceffa1cc6 Update all pypi.python.org URLs to pypi.org
For details on the new PyPI, see the blog post:

https://pythoninsider.blogspot.ca/2018/04/new-pypi-launched-legacy-pypi-shutting.html
2018-05-20 17:22:37 +01:00
Daniele Varrazzo
10caf1bd74 Command to upload docs on pythonhosted dropped altogether 2018-05-20 17:21:26 +01:00
Daniele Varrazzo
a110d7dd70 Intersphinx urls to generate Python links updated
Previous urls warn about a redirect, so they are probably to go.
2018-05-20 17:21:26 +01:00
Daniele Varrazzo
3f0a7f9af4 Added license to the docs
Includes other docs improvements, such as the ones proposed in #711.
2018-05-20 17:03:08 +01:00
Ashesh Vashi
1bec2bdc43
Merge branch 'master' into master 2018-05-08 15:17:59 +05:30
Daniele Varrazzo
df952c149d Fixed pip invocation example to skip binary packages
Close #673
2018-02-09 16:12:29 +00:00
Daniele Varrazzo
5b69adf797 Document the psycopg2-binary package 2018-01-29 03:23:59 +00:00
Daniele Varrazzo
8decf34ad7 Dropped warning about unsafe cursor names
It was long made secure
2018-01-25 22:00:40 +00:00
Daniele Varrazzo
ddef2e30cd 'key' docs in getconn() improved
Fix #569.
2018-01-11 00:14:36 +00:00
Daniele Varrazzo
04f1f06b9f Fixed stitch_text on Python 2 2018-01-10 22:49:00 +00:00
Jon Dufresne
389f6c08d9 Avoid installing tests to site-packages
For library end users, there is no need to install tests alongside the
package itself. This keeps the tests available for development without
adding extra packages to user's site-packages directory. Reduces the
size of the installed package. Avoids accidental execution of test code
by an installed package.
2017-12-10 10:55:58 -08:00
Jon Dufresne
9de46e416e Use print() function instead of print statement throughout project
Forward compatible with newer Pythons.
2017-12-10 10:51:07 -08:00
Jon Dufresne
19b1efd629 Drop long deprecated function register_tstz_w_secs()
Deprecated in commit b263fbf274 on
2010-01-13. The deprecation warning was first released in version 2.2.2.

The function used to register an alternate type caster for TIMESTAMP
WITH TIME ZONE to deal with historical time zones with seconds in the
UTC offset. These are now correctly handled by the default type caster,
so currently the function doesn't do anything.
2017-12-10 07:57:11 -08:00
Daniele Varrazzo
2218e73c28 Merge branch 'master' into ws 2017-12-02 14:47:29 +00:00
Jon Dufresne
e335d6d223 Trim trailing whitespace from all files throughout project
Many editors automatically trim whitespace on save. By trimming all
 files in one go, makes future diffs cleaner without extraneous
 whitespace changes.
2017-12-01 21:42:14 -08:00
Jon Dufresne
f5703dc3e5 Use builtin function next() throughout project
Available since Python 2.6. Use of .next() is deprecated and not
supported in Python 3. Forward compatible with modern Python.

https://docs.python.org/2/library/functions.html#next
2017-12-01 19:57:37 -08:00
Daniele Varrazzo
a0229cff82 Documentation tweaked to omit Python 2.6 distinctions 2017-11-28 16:11:06 +00:00
Hugo
c2d082e896 Drop support for EOL Python 3.0-3.3 2017-11-28 16:06:55 +00:00
Hugo
b69457ccdf Update to Exception as e, print() 2017-11-28 16:03:23 +00:00
Hugo
ffcc65d4f0 Drop support for EOL Python 2.6 2017-11-28 16:02:12 +00:00
Jon Dufresne
c1d3948be9 Update documentation to reflect JSON import behavior
The docs don't need to describe what will happen on Python versions
before 2.6 as they are unsupported by psycopg2.

Should have been included in commit
d58844e548, but was missed.
2017-11-28 06:38:44 -08:00
Jon Dufresne
05c28cce78 Remove workarounds for namedtuple on Python <= 2.5
namedtuple is available on all Python versions supported by psycopg2. It
was first introduced in Python 2.6. Can remove all workarounds and
special documentation.
2017-11-26 13:55:30 -08:00
Daniele Varrazzo
d88d8f9619 Added PostgreSQL 10 in the list of supported servers 2017-11-06 18:38:22 +00:00
Daniele Varrazzo
9614e7241b Further docs cleanup
Recent Sphinx versions seem overly aggressive in autodetecting python,
or I just didn't notice the errors, so be explicit in what language to
use with code examples.
2017-11-06 18:34:23 +00:00
Daniele Varrazzo
4f1505857b Parameters passing docs improved
Every point has an example and all the example show wrong/correct. Nice
rhythm.

Among the improvements, added point saying explicitly "thou shall not
quote placeholders".  Quoted placeholders will just fail except in the
most contrived cases (a statement raising an exception with all the
strings except with the attack ones...), and an example in the following
section explicitly notes "no quotes", but apparenty someone still thinks
this is not documented enough? (see issue #611) so let's just write it
plain and clear into the list of commandments.
2017-11-06 17:31:35 +00:00
Daniele Varrazzo
dfee199351 Dropped suggestion for --no-binary :all: to skip wheels
:all: applies to the entire file. --no-binary psycopg2 is the solution.

See issue #543
2017-10-27 12:34:00 +01:00
Daniele Varrazzo
f1461d2d7e Parse PG 10 error codes from final version 2017-10-19 02:28:52 +01:00
Daniele Varrazzo
e7587caee3 Dropped doc building warning
doctests have sure completely rotten however.
2017-10-18 21:57:17 +01:00
Daniele Varrazzo
4d68f6e414 Sphinx version do build docs updated to 1.6 2017-10-18 21:56:48 +01:00
Dmitry Shachnev
1ccb61fe18 Make dbapi_extension.py compatible with Sphinx 1.6
In Sphinx commit 1a821b89e9952fc2, the deprecated make_admonition()
function was removed. This commit updates the code to use the modern
API instead.
2017-10-12 13:10:41 +03:00
Ashesh Vashi
6e0edf7779 Merge remote-tracking branch 'psycopg2/master' 2017-09-11 18:26:34 +05:30
Daniele Varrazzo
22c7114168 Disable uploading docs on pythonhosted
The service is deprecated in favour of RTD. There is also no more way to
upload redirects there, so #581 cannot be fixed.

Official docs are on http://initd.org/psycopg/docs/
2017-08-23 13:42:49 +01:00
Daniele Varrazzo
2c836a2935 Fixed typo (found on stackoverflow... gh) 2017-07-27 12:10:11 +01:00
Ashesh Vashi
cfb0937605 Added support for preparing the encrypted password of a PostgreSQL
password using the libpq functions - 'PQencryptPasswordConn', and
'PQencryptPassword'.
2017-07-17 10:32:59 +05:30