Commit Graph

292 Commits

Author SHA1 Message Date
Oleksandr Shulgin
e69dafbecc Move the decode parameter to start_replication().
It makes more sense this way, because otherwise it must be passed to every call
of `read_message()`.
2015-10-23 11:31:55 +02:00
Oleksandr Shulgin
23abe4f501 Add quick start to the replication doc, minor doc fixes. 2015-10-20 12:36:13 +02:00
Oleksandr Shulgin
0bb81fc848 Properly subclass ReplicationCursor on C level. 2015-10-19 20:00:39 +02:00
Oleksandr Shulgin
4ab7cf0157 Replace stop_replication with requirement for an exception. 2015-10-19 15:42:42 +02:00
Oleksandr Shulgin
cf4f2411bf Fix async replication and test. 2015-10-15 18:01:43 +02:00
Oleksandr Shulgin
d14fea31a3 Use quote_ident from psycopg2.extensions 2015-10-15 12:56:21 +02:00
Oleksandr Shulgin
8e518d4954 Merge branch 'master' into feature/replication-protocol 2015-10-15 12:27:43 +02:00
Oleksandr Shulgin
9295bce154 Add psycopg2.extensions.quote_ident. 2015-10-14 17:00:25 +02:00
Oleksandr Shulgin
6ad299945f Remove IDENTIFY_SYSTEM wrapper method (it can't work with async anyway). 2015-10-13 18:05:33 +02:00
Oleksandr Shulgin
0233620c26 Rework replication connection/cursor classes 2015-10-01 19:33:27 +02:00
Oleksandr Shulgin
cac83da5db Use parse_dsn in ReplicationConnectionBase 2015-10-01 19:33:24 +02:00
Oleksandr Shulgin
95ee218c6d Update replication connection/cursor interface and docs. 2015-10-01 19:33:20 +02:00
Oleksandr Shulgin
937a7a9024 Cleanup start replication wrt. slot type a bit. 2015-10-01 19:33:16 +02:00
Oleksandr Shulgin
862eda10c2 Merge remote-tracking branch 'origin/master' into repl 2015-10-01 19:29:17 +02:00
Daniele Varrazzo
f635547ec6 The wait_select callback can cancel a query using Ctrl-C
Fixes #333.
2015-10-01 15:26:13 +01:00
Daniele Varrazzo
9e6c3322d8 Fixed PersistentConnectionPool on Python 3
Fixes ticket #348.
2015-10-01 14:44:14 +01:00
Oleksandr Shulgin
058db56430 Merge remote-tracking branch 'zalando/feature/replication-protocol' into feature/replication-protocol 2015-06-30 10:40:52 +02:00
Oleksandr Shulgin
61e52ce879 Rework replication protocol
This change exposes lower level functions for operating the
(logical) replication protocol, while keeping the high-level
start_replication function that does all the job for you in
case of a synchronous connection.

A number of other changes and fixes are put into this commit.
2015-06-30 10:38:18 +02:00
Oleksandr Shulgin
e3c3a2c19e Merge branch 'master' into feature/replication-message-object
Conflicts:
	lib/extensions.py
2015-06-30 10:30:32 +02:00
Oleksandr Shulgin
35a3262fe3 Expose ReplicationMessage type in extras 2015-06-11 12:20:52 +02:00
Oleksandr Shulgin
1ac385d1fb Fix logical decoding plugin options adaptation on python3 2015-06-10 13:39:35 +02:00
Oleksandr Shulgin
453830f80c Add ReplicationMessage object 2015-06-05 17:44:09 +02:00
Oleksandr Shulgin
44b705f88f Improve identify_system: don't hardcode column names 2015-06-02 16:52:48 +02:00
Oleksandr Shulgin
cc08e14162 Merge branch 'master' into feature/parse-dsn
Conflicts:
	lib/extensions.py
2015-06-02 12:42:03 +02:00
Oleksandr Shulgin
4bb6f9cef2 Add libpq version discovery 2015-06-01 18:05:11 +02:00
Oleksandr Shulgin
6a2f21aa14 Move parse_dsn to extensions, add tests 2015-06-01 15:11:12 +02:00
Oleksandr Shulgin
e32e1b834e Add support for streaming replication protocol
Introduce ReplicationConnection and ReplicationCursor classes, that
incapsulate initiation of special type of PostgreSQL connection and
handling of special replication commands only available in this special
connection mode.

The handling of stream of replication data from the server is modelled
largely after the existing support for "COPY table TO file" command and
pg_recvlogical tool supplied with PostgreSQL (though, it can also be
used for physical replication.)
2015-06-01 11:45:04 +02:00
Oleksandr Shulgin
6c57e4a648 Add parse_dsn module function
Calls PQconninfoParse to parse the dsn into a list of keyword and value
structs, then constructs a dictionary from that.  Can be useful when one
needs to alter some part of the the connection string reliably, but
doesn't want to get into all the details of parsing a dsn string:
quoting, URL format, etc.
2015-06-01 10:16:07 +02:00
andrew deryabin
41639c7610 Fixed MinTimeLoggingCursor.callproc() 2015-05-03 10:30:11 +01:00
Daniele Varrazzo
569fd0975b Python 3.1 bytes.decode() doesn't support keyword arguments
Sucker.
2015-02-08 19:43:09 +00:00
Daniele Varrazzo
7ea56b112e Make Column picklable on Python >= 3.3
Also expose the type from the extensions module, not from the main
module.
2015-02-08 11:27:10 +00:00
Owen Raccuglia
5af5fb4cc6 Allow pickling of cursor.description
This is for people using dtuple.py; a dtuple.DatabaseTuple instance
keeps a reference to cursor.description, which is not picklable because
psycopg2 doesn't export the Column namedtuple it uses.

This commit exports the Column namedtuple, and includes a test to verify
the pickle/unpickle works after exporting Column.
2015-02-08 02:31:33 +00:00
Erik Lee
e9f54a2d6e Correct exausted -> exhausted typo 2014-11-17 17:01:00 +00:00
Daniele Varrazzo
6705e4051d Dropped creation of errcodes with missing spec field
On further inspection these names are just aliases for values already
defined: we don't need the duplication.
2014-08-28 02:17:57 +01:00
Daniele Varrazzo
41a083cec3 Convert pool arguments to int
Failing to do so may cause dangerous misbehaviours such as an unbounded
pool (because of lame comparison operators in Python 2).

Fix ticket #220.
2014-08-13 02:39:16 +01:00
Daniele Varrazzo
9d547469b8 Add register_default_jsonb() and register the type 2014-08-13 02:02:01 +01:00
Daniele Varrazzo
6bca443e37 Added name param to register_json() 2014-08-13 02:01:55 +01:00
Daniele Varrazzo
40dca9924d Add a few missing errcodes
They are used in the code but not defined in the SGML docs so the script
failed to parse them.
2014-07-31 13:34:53 +01:00
Daniele Varrazzo
283dbccf56 Merge branch 'range_sort' 2014-02-22 23:02:19 +00:00
Daniele Varrazzo
dd9e476353 Fixed error message on range parsing failed 2014-02-22 23:02:07 +00:00
Daniele Varrazzo
8937c635df Hardcode the list of attributes to be used in comparison
Comparing Range subclasses may lead to surprises.
2014-02-22 21:52:44 +00:00
Daniele Varrazzo
4545d1636c Added implementation for Range gt and ge operators
Using a common implementation for all the operators. Note that lt is the
one used by sort so it's nice it's the fastest.
2014-02-22 21:51:28 +00:00
Daniele Varrazzo
6192a4fb17 Added str() for the Json adapter
Fixes ticket #191.
2014-02-22 20:45:35 +00:00
Chris Withers
e60266c4c5 New implementation of Range sorting that works for Python 2.5 to 3.3, at least. 2014-02-18 20:55:00 +00:00
Chris Withers
d469c32503 Provide a stable and consistent sort order for Range objects.
This matches postgres server-side behaviour and helps client applications that need to sort based on the primary key of tables where the primary key is or contains a range.
2014-02-12 08:11:59 +00:00
Chris Withers
28276e3eb1 cater for comparison of subclasses 2013-05-26 22:20:07 +01:00
Chris Withers
b6a9e0ffaf raising an exception here rather than returning False causes problems with SQLAlchemy's internal state tracking 2013-05-26 21:58:39 +01:00
Chris Withers
8bb44f3444 more useful error message when comparing ranges with non-ranges 2013-05-26 21:20:40 +01:00
Piotr Kasprzyk
31b6ec63f8 Fix multiple misspellings 2013-04-26 09:59:40 +01:00
Daniele Varrazzo
fc2ca0d2e9 Make sure to return a bytes string from numeric range adapter 2013-04-21 20:30:50 +01:00