Daniele Varrazzo
6893295a87
Added docs about make_dsn
...
connect() docs updated to document the arguments merging.
2016-03-03 17:09:15 +00:00
Daniele Varrazzo
2c55a1bd53
Verify that the dsn is not manipulated by make_dsn if not necessary
2016-03-03 15:07:38 +00:00
Daniele Varrazzo
1c4523f0ac
Implementation of make_dsn in Python
...
This is equivalent to what proposed in #363 , but with a much simpler
implementation.
2016-03-03 04:33:59 +00:00
Federico Di Gregorio
b737757eac
Merge pull request #375 from kwotuveang3k4bk/patch-1
...
Update psycopg1.py
2016-01-31 12:55:52 +01:00
Daniele Varrazzo
5fd0f6c4ee
Fixed race condition on import in errorcodes.lookup
...
Fixes #382 .
2015-12-16 12:03:10 +00:00
Jan Janßen
b3def74002
Update psycopg1.py
2015-11-10 17:02:59 +01:00
Oleksandr Shulgin
fbcf99ad07
Move replication connection to C level.
2015-10-27 18:21:24 +01:00
Oleksandr Shulgin
433fb957cb
Merge branch 'feature/connect2' into feature/replication-protocol
2015-10-27 17:37:18 +01:00
Oleksandr Shulgin
7aba8b3ed0
Rework psycopg2.connect() interface.
2015-10-27 17:35:57 +01:00
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
Daniele Varrazzo
711c092a79
The UUID adapter returns bytes instead of str in Python 3
...
Also added __conform__ method to the adapter.
2013-04-07 22:19:04 +01:00
Daniele Varrazzo
884a7f7db6
A couple of typos fixed
2013-04-07 16:05:36 +01:00
Daniele Varrazzo
2b554937f2
Dropped __all__ from modules
...
They were only used to generate docs with Epydoc, now largely forgotten.
Imports in extras cleaned up to expose the API only.
2013-04-07 02:59:30 +01:00
Daniele Varrazzo
d5d6a1f4c7
Enable by default the range typecasters
...
Otherwise it would have been enabled importing psycopg2.extras,
which is a surprising behaviour.
2013-04-07 02:37:55 +01:00
Daniele Varrazzo
9e15f54fe8
Added cursor_factory connection attribute and connect() parameter
2013-04-07 02:30:12 +01:00
Daniele Varrazzo
b6873ee1ab
Dropped support for Python 2.4
2013-03-20 23:40:13 +00:00
Daniele Varrazzo
97311967e8
Merge branch 'diagnostics' into devel
2013-03-18 02:21:09 +00:00
Daniele Varrazzo
9e79112e25
Expose the Diagnostics object in the extensions module
2013-03-17 23:58:10 +00:00
Daniele Varrazzo
06bfa801f4
Fixed range adaptation on Python 3
2013-03-16 22:12:41 +00:00
Daniele Varrazzo
e1ff432f4c
Merge branch 'dead-bytes' into devel
2013-03-16 16:25:17 +00:00
Daniele Varrazzo
6df6e6adfe
Fixed pickling of DictRow objects too
2012-12-11 01:10:45 +00:00
Daniele Varrazzo
99bedd1bb2
Fixed pickling of RealDictRow objects
2012-12-10 23:54:25 +00:00
Daniele Varrazzo
27cd6c4880
Added specific pool implementation for ZPsycopgDA
...
The implementation is based on psycopg 2.4, which should be less broken
(zope-wise) of the current one.
Instantiating psycopg2.pool.PersistentConnectionPool now raises a warning.
This should fix ticket #123 , #125 . The issue of the reset on
set_client_encoding() is still present but that's always been there and I'm no
good at fixing it.
2012-12-04 00:30:58 +00:00
Daniele Varrazzo
9a031db8b9
Fixed empty strings handling in composite caster
...
Closes ticket #141 .
2012-12-03 14:19:09 +00:00
Daniele Varrazzo
2a9e5c7203
Dropped configuration of unused logger inside the pool module
2012-12-03 00:39:47 +00:00
Daniele Varrazzo
1feb179fba
Fixed pickling of FixedOffsetTimezone objects
...
I have also verified that the fixed class can unpickle instance pickled with
the buggy one and viceversa.
Fixes ticket #135 .
2012-10-21 21:47:32 +01:00
Daniele Varrazzo
a33c0670fd
More idiomatic way to call FixedOffsetTimezone.__new__ superclass
2012-10-21 21:16:52 +01:00
Daniele Varrazzo
f5f2e2c092
Dropped redundant call to FixedOffsetTimezone.__init__
2012-10-21 21:12:02 +01:00
Daniele Varrazzo
9f9da182f1
Using super() in the connection/cursor subclasses
...
This opens to collaborative subclassing (e.g. you may want to have a
logging namedtuple cursor...)
2012-09-28 02:51:58 +01:00
Daniele Varrazzo
4244d5953a
Merge branch 'range-type' into devel
2012-09-27 00:48:05 +01:00
Daniele Varrazzo
dda24f082f
Merge branch 'json' into devel
2012-09-27 00:41:04 +01:00
Daniele Varrazzo
33043cd038
Merge branch 'composite-custom' into devel
2012-09-27 00:38:00 +01:00
Daniele Varrazzo
bc1d2f5d3a
Merge remote-tracking branch 'github/connect-keywords' into devel
2012-09-26 13:15:33 +01:00
Daniele Varrazzo
20d3d0f66d
Raise TypeError instead of InterfaceError on bad params on connect()
...
TypeError is the standard Python error raised in this case:
$ python -c "(lambda a: None)(b=10)"
TypeError: <lambda>() got an unexpected keyword argument 'b'
We only used to raise InterfaceError when connect was used without
any parameter at all, so it's hard to think a program depending on
that design. Furthermore the function has always raised (and still
does) OperationalError too, if the bad argument is detected by the
libpq, and that cannot be changed because we can't tell the
difference from a normal connection error.
2012-09-26 11:55:21 +01:00
Daniele Varrazzo
cf3c6f86ff
Improved error message on connect when kwargs are passed together with dns
2012-09-26 11:47:06 +01:00
Daniele Varrazzo
cd316a94f1
Dropped quirks in connection arguments handling
...
Now connect() raises an exception instead of swallowing keyword arguments
when a connection string is specified as well
Closes ticket #131 .
2012-09-25 23:46:46 +01:00
Daniele Varrazzo
b894539007
Fixed json doc error
2012-09-25 00:12:57 +01:00
Daniele Varrazzo
b8b669611e
More helpful error messasge on Range order attempts
2012-09-25 00:07:08 +01:00
Daniele Varrazzo
7b1973354f
Fixed SQL_IN when getquoted() is called without prepare()
2012-09-24 16:55:01 +01:00
Daniele Varrazzo
71e2f190c2
Json documentation improved
2012-09-24 11:51:35 +01:00
Daniele Varrazzo
a3418052e9
Don't create/register a json array typecaster if no oid provided
2012-09-24 11:23:09 +01:00
Daniele Varrazzo
c756d580f2
Added documentation for range types and adaptation
2012-09-24 00:49:44 +01:00
Daniele Varrazzo
b1953640d2
Don't need to implement __new__ to make an immutable class
2012-09-24 00:49:02 +01:00
Daniele Varrazzo
a858987844
Fixed search of types into schemas.
...
We don't need to look for stuff implicitly into pg_catalog as all
the builtin ranges are already registered. So just search into
'public' if the schema is not specified.
2012-09-24 00:49:02 +01:00
Daniele Varrazzo
841ddaba87
Range objects cannot be ordered
2012-09-23 22:54:50 +01:00
Daniele Varrazzo
25ef540aa3
Range objects are nonzero when not empty
2012-09-23 22:43:23 +01:00
Daniele Varrazzo
a96a4349ed
Range objects are immutable and hashable
2012-09-23 22:40:13 +01:00
Daniele Varrazzo
e002ea5937
Dropped Range._empty attribute
...
We can do with just _bounds: it will make eq and hash easier to
implement in a consistent way
2012-09-23 22:10:33 +01:00
Daniele Varrazzo
d2cee6f9ad
Added in operator for ranges
2012-09-23 22:01:39 +01:00
Daniele Varrazzo
94c6353d55
NumberRange renamed to NumericRange
...
I was avoiding Numeric to avoid conflicting with the 'numeric'
Postgres type, which is an alias for 'decimal'. But now that there
is a single numeric range I can use the preferred name
2012-09-23 21:11:06 +01:00
Daniele Varrazzo
45cbcc0713
Dropped Range classes for specific numeric types
2012-09-23 21:08:18 +01:00