Commit Graph

431 Commits

Author SHA1 Message Date
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
Daniele Varrazzo
5e7c1d0b51 Added first implementation of Range type, adapter, typecaster 2012-09-23 21:03:36 +01:00
Daniele Varrazzo
9949e04c70 Added schema attribute to CompositeCaster 2012-09-22 15:10:40 +01:00
Daniele Varrazzo
59151886a0 Info about hstore versions history moved from code to docs 2012-09-22 02:10:58 +01:00
Daniele Varrazzo
26cfdc1234 Info about versions history moved from code to docs 2012-09-22 02:08:21 +01:00
Daniele Varrazzo
fa9393b587 Added documentation about CompositeCaster subclassing 2012-09-22 02:01:04 +01:00
Daniele Varrazzo
1b2c2c34b6 Make CompositeCaster easier to subclass 2012-09-22 01:46:53 +01:00
Daniele Varrazzo
7de8611607 errorcodes map updated to PostgreSQL 9.2 2012-09-21 01:59:02 +01:00
Daniele Varrazzo
526e270934 Use namedtuple._make in NamedTupleCursor and CompositeCaster
Makes things more natural as _make has the same signature of the tuple (see
_ctor in CompositeCaster) and is probably more efficient with less
intermediate sequences to build.
2012-09-20 16:27:50 +01:00
Daniele Varrazzo
5645e7adef Pasto fixed 2012-09-20 03:44:50 +01:00
Daniele Varrazzo
9b2ad7abb5 Fixed json typecaster with NULL input 2012-09-20 00:39:34 +01:00
Daniele Varrazzo
7386b8327c Dropped keywords passthrough in Json adapter
Pass a dumps function instead. Allow customizing by either arg passing or
subclassing.

The basic Json class now raises ImportError on getquoted() if json is not
available, thus allowing using a customized Json subclass even when the json
module is not available.
2012-09-19 16:32:57 +01:00
Daniele Varrazzo
d963b478e2 Added register_default_json() function
Register a typecaster for PostgreSQL 9.2 json.
2012-09-19 15:49:00 +01:00
Daniele Varrazzo
26d71b4cba First parameter of register_json defaults to None 2012-09-19 15:31:28 +01:00
Daniele Varrazzo
024f0dbada Added json typecaster 2012-09-19 04:26:35 +01:00
Daniele Varrazzo
b8e7f02256 Added Json adapter 2012-09-19 04:12:20 +01:00
Daniele Varrazzo
21d323d2c8 Fixed register_hstore and register_composite with non-dbapi objects
Closed ticket #114.
2012-08-14 23:26:17 +01:00
Daniele Varrazzo
ba1fe6fff6 Fixed superclass methods call.
Methods execute() and callproc() in DictCursor and RealDictCursor should
call DictCursorBase methods, not _cursor's ones.

Reported by Alexey Luchko on the ML.
2012-05-08 15:48:07 +01:00
Daniele Varrazzo
c86ca7687f Fixed cursor() arguments propagation to other connection classes 2012-04-11 17:59:16 +01:00
Corry Haines
095cce5605 Allow user to override connection factory cursors
Prior to this change, using a extras.connection_factory would not allow
any other cursor to be used on that connection. It was set in stone.

This change allows all cursor options to pass through and override the
connection factory behaviors. This allows a connection_factory to be
dropped into existing code with no disruption.

This change also standardizes the extras.connection_factories to have
the same behavior and all pass through *args and **kwargs.
2012-04-11 17:36:04 +01:00
Marti Raudsepp
b97599166e Update all links to PostgreSQL docs to the current version.
I also checked all links and anchors to make sure they're still valid.
2012-02-28 18:28:07 +02:00
Daniele Varrazzo
0c337a2029 Added support for inet array 2012-02-23 23:56:55 +00:00
Daniele Varrazzo
36b6c80ed1 register_uuid takes more iterables types as oids argument
Also added docs for the function parameters.
2012-02-23 23:51:28 +00:00
Daniele Varrazzo
b8597dc1d3 Fixed NamedTupleCursor rownumber during iteration.
The correction is similar to the other one for the other subclasses.

Also added tests for rowcount and rownumber during different fetch styles.
Just in case.
2012-02-23 22:58:58 +00:00
Daniele Varrazzo
ebec522a07 Fixed rownumber for cursor subclasses during iterations
Regression introduced to fix ticket #80. Don't use fetchmany to get the
chunks of values. I did it that way because I was ending up into infinite
recursion calling __iter__ from __iter__: the solution has been the
"while 1: yield next()" idiom.
2012-02-23 22:55:13 +00:00
Daniele Varrazzo
dca6cffd6e Dropped custom array parsing for UUID[]
Use the C generic array parsing exposed by new_array_type().
2012-02-23 14:41:55 +00:00
Daniele Varrazzo
f782470d71 Parens don't need escaping in regexp char classes 2012-02-23 14:41:51 +00:00
Daniele Varrazzo
1332d4a0d8 Fixed never raised exception in composite parsing 2012-02-23 14:41:46 +00:00
Menno Smits
bca7200b3f Cache FixedOffsetTimezone instances
Avoid creating new a new FixedOffsetTimezone instance if one with the
same offset and name has been created before. This will save memory
when returning many rows containing "timestamp with timezone" columns,
and also improves comparability.
2012-01-30 13:27:40 +00:00
Menno Smits
1469a56512 Fixed repr for FixedOffsetTimezone for offsets west of UTC (negative)
The offset displayed was always positive and somewhat confusing. The
offset displayed now is the offset that the instance was created
with.

Also added some tests for initialisation.
2012-01-30 13:27:01 +00:00
Daniele Varrazzo
2cf35b69de 'register_composite()' also works with tables
Skip dropped and hidden columns when inspecting the schema.
2011-12-15 20:11:17 +00:00
Daniele Varrazzo
a4485022b5 Use 'autocommit' to check if to rollback after extra types registration
isolation_level currently requires an extra query, autocommit doesn't.
2011-12-15 19:56:52 +00:00
Daniele Varrazzo
bb8e1e9455 Fixed error in schema mismatch in composite caster 2011-12-15 19:56:52 +00:00
Daniele Varrazzo
5a6a303d43 A couple of fixes to psycopg1
_psycopg.connect is no more. Also use symbolic consts instead of values
for the isolation level.
2011-12-15 13:06:32 +00:00
Daniele Varrazzo
b5de04d2ff Put back a distinct ISOLATION_LEVEL_READ_UNCOMMITTED value 2011-12-15 12:53:48 +00:00
Federico Di Gregorio
d2d94e203f Reverted isolation level values to backward compatible values
This basically removes the READ UNCOMMITED level (that internally
PostgreSQL maps to READ COMMITED anyway) to keep the numeric values
compattible with old psycopg versions. For full details and discussion
see this thread:
http://archives.postgresql.org/psycopg/2011-12/msg00008.php
2011-12-15 12:25:19 +01:00
Daniele Varrazzo
8473209d24 Named DictCursor/RealDictCursor honour itersize
Closes ticket #80.
2011-12-11 22:06:15 +00:00
Daniele Varrazzo
e18d27c475 Reproducing/documenting odd behaviours of connect() 2011-11-17 21:51:24 +00:00
Daniele Varrazzo
625cc1b402 Escape parameters to the connection strings as required by PQconnectdb 2011-11-17 21:51:24 +00:00
Daniele Varrazzo
d2b67364fd connect() supports generic keyword arguments passed to the dsn 2011-11-17 01:51:25 +00:00
Daniele Varrazzo
dde4c0de3d Decimal adapter registration moved from C to Python
Fixes Decimal adaptation in sub-interpreter, where the Decimal class has
a different identity from the one in the main interpreter.

Closes ticket #52.
2011-10-14 22:35:56 +01:00
Daniele Varrazzo
8963b8adcb Added support for arrays of composite types 2011-09-22 19:57:42 +02:00
Daniele Varrazzo
2f9ceeac64 Added support for arrays of hstores 2011-09-22 19:56:58 +02:00
Daniele Varrazzo
e3054ac9f3 Added new_array_type() function
Allows the creation of a generic array typecaster from Python.
2011-09-22 15:51:21 +01:00
Daniele Varrazzo
cd6e2cd8f2 Don't leak private variables into the psycopg2.extensions interface 2011-09-22 14:34:14 +01:00
Daniele Varrazzo
d67d50b434 Fixed interaction between RealDictCursor and named cursors
Closes ticket #67.
2011-09-12 02:20:53 +01:00
Daniele Varrazzo
29932c488f errorcodes map updated to PostgreSQL 9.1 2011-08-22 17:29:14 +01:00
Daniele Varrazzo
9870ca4dce Fixed NamedTupleCursor.executemany() (ticket #65) 2011-08-09 11:44:30 +01:00
Daniele Varrazzo
a2ee25ecfe Check the connection status before putting back into the pool
Rollback connections in transaction or in error.
Discard broken connections.
Closes ticket #62.
2011-08-09 11:44:30 +01:00
Daniele Varrazzo
4fd5f3267b Raise PoolError when putting a connection not belonging to the pool
A KeyError was raised instead.
2011-08-09 11:44:30 +01:00
Marko Kreen
cb1d163f4f lazy import for uuid module
Attached patch moves uuid import from inside try-except
to register_uuid function.  Reason: uuid module import is *very*
heavy.  It goes into OS searching for various .dll/.so libraries,
lauches 'ldconfig' and so on...

With this patch, 200x python -c 'import psycopg2.extras'
goes from 22s to 7s.  (plain 'import psycopg2' is 6s)

--
marko
2011-06-28 17:28:43 +02:00
Daniele Varrazzo
62a8ef308a Fixed version check 2011-06-04 14:21:18 +01:00
Daniele Varrazzo
531292bca5 Merge branch 'neg-escape' into devel 2011-05-30 22:09:23 +01:00
Daniele Varrazzo
281427f450 Fixed escape for negative numbers prefixed by minus operator
Closes ticket #57.
2011-05-30 22:00:20 +01:00
Daniele Varrazzo
19ec8809fd Use all the isolation levels accepted by PostgreSQL
In PG 9.1 repeatable read and serializable are distinct levels.
2011-05-11 13:01:20 +01:00
Daniele Varrazzo
c61ec094a3 Don't fetch all the records iterating a NamedTuple cursor on a named cursor 2011-04-26 19:26:19 +01:00
Daniele Varrazzo
ffa7a62b93 Fixed interaction between NamedTuple and named cursor
Build the nametuple after fetching the first resutl, or else
cursor.description will be empty.
2011-04-26 19:18:39 +01:00
Daniele Varrazzo
80891e64b3 Dropped unused import 2011-04-26 19:16:10 +01:00
Daniele Varrazzo
9e00196165 Fixed use of the new return value of HstoreAdapter.get_oids() 2011-02-25 01:37:02 +00:00
Daniele Varrazzo
5211e1474b Don't limit the hstore search to the public schema only
Looks like there is a case for installing hstore somewhere else (see
ticket #45). And after all the typecaster can be registered on a list of
OIDs, so let's grab them all.
2011-02-25 00:19:49 +00:00
Daniele Varrazzo
143dc2e911 Added oid parameter to register_hstore()
The parameter is mostly useful with async connections that would need a
different protocol to be queried.

Issue reported by Jan "the Asynchronous".
2011-02-21 01:29:53 +00:00
Daniele Varrazzo
556b4d461e Documentation cleanup
Added several links to the Python documentation using the 'intersphinx'
extension.
2011-02-19 16:16:28 +00:00
Daniele Varrazzo
1ba5f104c9 Import _psycopg as the first module in the package
Failing to do so, the real cause of the _psycopg import failed may get
hidden and people may get a misleading error such as "cannot import name
tz" instead.
2011-02-17 10:45:18 +00:00
Daniele Varrazzo
7a058403ca Fixed mapping for composite types defined in a schema 2011-02-09 02:22:03 +01:00
Daniele Varrazzo
8ac5f0070a Fields order enforced in composite types adapter 2011-02-09 02:21:55 +01:00
Daniele Varrazzo
ac5cde8834 Only use absolute imports in the package
In Python 3.2b2 the relative imports are not converted into explicit
ones (with .).
2011-01-08 01:24:28 +00:00
Daniele Varrazzo
80bd6e2794 Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	psycopg/connection_type.c
	tests/test_connection.py
	tests/types_basic.py
2011-01-03 21:43:02 +01:00
Daniele Varrazzo
68305a0eb6 Fixed TYPE adaptation to basic tuples
Tuples and namedtuples have different constructors.
2011-01-03 19:27:26 +01:00
Daniele Varrazzo
929d62053a Merge branch 'python2' into python3
Conflicts:
	NEWS-2.3
	setup.py
2011-01-02 03:28:00 +01:00
Daniele Varrazzo
88bb8eda3e None/IN adaptation ported to Python 3. 2011-01-02 00:44:14 +01:00
Daniele Varrazzo
7ac0bdd661 Added PostgreSQL composite types typecaster to Python tuples. 2011-01-02 00:34:13 +01:00
Daniele Varrazzo
3e94375cf7 Merge branch 'python2' into python3
Conflicts:
	ChangeLog
	NEWS-2.3
	lib/extensions.py
	psycopg/microprotocols.c
	setup.py
2011-01-01 17:14:54 +01:00
Daniele Varrazzo
fdfa2de1a1 Fixed adaptation of None in composite types (ticket #26).
Added an adapter for None: it is usually not invoked as adaptation to
NULL is a fast path in mogrify, but can be invoked by composite types.
Notice that composite types still have the option to fast-path None
(e.g. list adapter does).
2011-01-01 17:07:54 +01:00
Daniele Varrazzo
2fa9117835 Inet adapter compatible with Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
c176de4bf8 Hstore adapter compatible with Python 3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
89c492d3a4 Added b() function to return bytes in both Py2 and Py3. 2010-12-31 03:18:27 +01:00
Daniele Varrazzo
e18f1c63ea Deal with slices passed to __*item__ in Python 3. 2010-12-23 03:28:19 +01:00
Daniele Varrazzo
b96dcef8a2 Fixed PG -> Py encodings mapping with non-alnum chars.
We mangle the encoding names a little bit before asking it to the
backend: be sure to be able to find the equivalent Python code back or
decoding (unicode cast or Py3) will barf.
2010-12-21 04:02:14 +00:00
Daniele Varrazzo
31093a7a58 Some light cleanup for Py3 conversion.
Either flagged as warning by python2.6 -3 or converted by 2to3.
2010-12-21 04:02:13 +00:00
Daniele Varrazzo
0ad7483a2b DictRow items can be updated. Patch by Alex Aster. 2010-12-01 13:17:12 +00:00
Daniele Varrazzo
94348bfb78 hstore registration doesn't fail if typarray column not available. 2010-11-19 03:51:53 +00:00
Daniele Varrazzo
3cae0f3f5d NamedTupleCursor doesn't change exception when fetching with no result. 2010-11-11 10:39:42 +00:00
Daniele Varrazzo
ef7a5ee8a9 Build the namedtuple only once per execution, not once per fetch. 2010-11-11 10:39:42 +00:00
Daniele Varrazzo
f0773d5682 Avoid pointless string manipulation in NamedTupleCursor.
Closes ticket #10. Reported by Marko Kreen.
2010-11-09 11:17:02 +00:00
Daniele Varrazzo
abad3127ca Added NamedTupleCursor. 2010-11-06 04:33:44 +00:00
Daniele Varrazzo
01ec120aa8 Hstore documentation improved. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
4b98e8941f Added some documentation for the hstore adaptation. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
d5bf400cb4 The hstore typecast can be registered globally. 2010-11-05 09:34:52 +00:00
Daniele Varrazzo
bb41acd1da Favour the PG9 implementation of the hstore adapter. 2010-11-05 09:34:51 +00:00
Daniele Varrazzo
ed623776f3 Hstore can return unicode keys and values. 2010-11-05 09:34:51 +00:00
Daniele Varrazzo
af835f8857 Correctly parse escaped quotes from hstore.
Parse regexp simplified.
2010-11-05 09:34:50 +00:00
Daniele Varrazzo
70880dde79 Added special cases to store empty dicts. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
6d441b6e03 Added hstore typecaster registration. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
fef9727cce parse_hstore converted in class method. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
5844e989c4 Added function to parse an hstore into a dict. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
5693c9cab1 Added implementation of python dict adapter to hstore. 2010-11-05 09:34:50 +00:00
Daniele Varrazzo
2f29429e88 Expose the Xid object in the extension module. 2010-11-05 09:34:49 +00:00
Daniele Varrazzo
4f66de494b Added tpc_prepare and CONN_STATUS_PREPARED. 2010-11-05 09:34:48 +00:00
Daniele Varrazzo
4ec298e112 Notify object exposed in the extensions module. 2010-11-05 09:34:47 +00:00
Daniele Varrazzo
575b2b5f77 The Inet type knows how to adapt itself.
Implemented __conform__ as the Adaptation PEP suggests. It is not
required for the type to be registered as adapter.
2010-09-25 23:55:55 +01:00
Daniele Varrazzo
75a6f783c5 Added PostgreSQL 9.0 error codes. 2010-09-23 23:43:23 +01:00
Federico Di Gregorio
b263fbf274 Added deprecation warning to register_tstz_w_secs 2010-07-13 14:26:52 +02:00
Daniele Varrazzo
927f2bb1f1 Dropped logging.basicConfig() call.
It messes up with projects using logging but where no handler is
installed on the root logger.  Bug reported by Joe Abbate.
2010-07-09 23:23:10 +01:00
Daniele Varrazzo
4a78e4068b Dropped register_tstz_w_secs() implementation.
The function is no-op now that the default type caster can deal with
seconds in the tz offset.
2010-05-20 02:18:04 +01:00
Daniele Varrazzo
60e7522e47 Added evaluable representation for the FixedOffsetTimezone object. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
d30daac782 Fixed typo in LocalTimezone doc. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
e8c2a14362 Added typecasters for arrays of specific MX/Py time-related types. 2010-05-15 14:27:23 +01:00
Daniele Varrazzo
127f92f9db Changed 'psyco_wait()' to only take the connection. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
8ba0f00d21 Added 'get_wait_callback()' function. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
1446f046e9 Added wait callback and functions to deal with it. 2010-04-21 15:21:32 +01:00
Daniele Varrazzo
d162c08cfa PY* and MX* typecasters imported into the extensions module. 2010-04-14 00:27:28 +01:00
Daniele Varrazzo
54e9c89ea4 DECIMAL typecaster imported into the extensions module. 2010-04-14 00:20:16 +01:00
Federico Di Gregorio
c1a24f4ca2 NOTIFYs fix and poll status changes
POLL_OK has been changed from 3 to 0 to let the user specify a short loop
just as "if not curs.poll()" instead of having to check for write and read
separately. For an example of this, see examples/notify.py.
2010-04-05 16:52:25 +02:00
Jan Urbański
01799e9137 Make asynchronous connections produce asynchronous cursors by default
Drop the async kwarg from cursor.execute(), cursors created by
asynchronous connections will be asynchronous by default, ones created
by synchronous connections will be synchronous.

Mind that this might break third party subclasses of
psycopg2.extensions.cursor, if they try to chain to the superclass in
their execute() implementation and are passing the async kwarg. The
example cursors in psycopg2.extras have been fixed no to do that.
2010-04-05 11:41:32 +02:00
Federico Di Gregorio
34317dc4c3 Support asynchronous connection building
After calling psycopg2.connect(dsn, async=True) you can poll the
connection that will tell you whether its file descriptor should be
waited on to become writable or readable or that the connection
attempt has succeeded.

Edited commit by Jan to not expose internal state in extensions.py.
2010-04-05 11:30:03 +02:00
Daniele Varrazzo
97ced0d4f1 Use the default role for cross referencing Python objects. 2010-02-26 00:49:19 +00:00
Daniele Varrazzo
4412826556 Added documentation for the 'pool' module. 2010-02-26 00:46:23 +00:00
Daniele Varrazzo
a320f25a2a Completed documentation for errorcodes module. 2010-02-16 00:38:44 +00:00
Daniele Varrazzo
96b7912bcf Typo fixed in DictRow doc. 2010-02-16 00:38:15 +00:00
Daniele Varrazzo
d08d9ab199 Added errorcodes.lookup() function. 2010-02-15 01:38:49 +00:00
Daniele Varrazzo
bcfdbd1903 Error codes updated to include all errors between PostgreSQL 8.1 and 8.4. 2010-02-15 01:07:28 +00:00
Daniele Varrazzo
be30f43181 Inet adapter fixed. 2010-02-14 20:14:17 +00:00
Federico Di Gregorio
4b58fc640e License change for lib/errorcodes.py
You hereby have my blessing to go ahead and license all my contributions to
the psycopg2 project, including lib/errorcodes.py to LGPL3(+).

-- Johan Dahlin
2010-02-14 01:19:17 +01:00
Daniele Varrazzo
3789f8fb17 Added other info about tz module. 2010-02-14 00:39:48 +01:00
Daniele Varrazzo
6a4ff65b49 Added documentation for the extras module. 2010-02-14 00:39:48 +01:00
Daniele Varrazzo
e1b3c7b940 Fixed Inet constructor. 2010-02-14 00:35:48 +01:00
Daniele Varrazzo
0dbe068df4 Stop the loop variable used to create __all__ leaking in the module. 2010-02-14 00:35:47 +01:00
Federico Di Gregorio
0089201ba2 Binary was not imported from _psycopg; now it is 2010-02-13 00:52:36 +01:00
Federico Di Gregorio
a9673f31d6 SQL_IN adapter is now automatically registered 2010-02-13 00:40:29 +01:00
Federico Di Gregorio
611606d532 Changes license to LGPL3 + OpenSSL exception on all source files 2010-02-12 23:34:53 +01:00
Federico Di Gregorio
e5bed4993b Fixed register_tstz_w_secs() error 2010-02-10 18:16:00 +01:00
Federico Di Gregorio
390a9c2451 Added support for UUID arrays 2009-10-04 12:34:02 +02:00
Federico Di Gregorio
e1fae0fcac Fixed bug in RealDictCursor when prefetching 2009-05-09 14:44:59 +02:00
Federico Di Gregorio
06eb574cec Applied DictRow "diet" patch 2009-05-09 10:19:15 +02:00
Federico Di Gregorio
bb77a6912f Added missing dict methods in DictRow 2009-04-19 16:25:12 +02:00
Federico Di Gregorio
825a60eec5 Removed spurious print 2009-03-16 22:15:20 +01:00
Federico Di Gregorio
1daf300ca3 Support for seconds in time zone offsets 2009-03-02 11:07:17 +01:00
Federico Di Gregorio
5b04203c9f Fixed error in register_type() 2009-03-02 10:59:52 +01:00
Federico Di Gregorio
9b259bba86 Removed some spurious tabs 2009-02-23 21:39:25 +01:00
Federico Di Gregorio
eb25f9f154 Added adapter to handle float('inf') and float('nan') 2009-01-23 00:09:20 +01:00
Federico Di Gregorio
4c8e80038e Added inet support 2008-09-24 01:27:52 +02:00
Federico Di Gregorio
56f6001d6d Support for NULLs in UUID 2008-09-23 09:11:11 +02:00
Federico Di Gregorio
b92601306e Added suppport for UUID and related test. 2008-09-19 21:25:16 +02:00
Federico Di Gregorio
e664abb248 Added XXXARRAY imports to psycopg2.extenions 2008-05-30 00:39:50 +02:00
James Henstridge
938c456cee Merge changes from psycopg2/trunk via psycopg2.r243. 2008-05-05 10:37:24 +08:00
James Henstridge
f64cbeda46 * tests/test_transaction.py (DeadlockSerializationTestCase): port
over some tests for serialisation and deadlock errors,
	demonstrating that TransactionRollbackError is generated.
	(QueryCancelationTests): add a test to show that
	QueryCanceledError is raised on statement timeouts.

	* psycopg2da/adapter.py (_handle_psycopg_exception): rather than
	checking exception messages, check for TransactionRollbackError.

	* psycopg/pqpath.c (exception_from_sqlstate): return
	TransactionRollbackError for 40xxx errors, and QueryCanceledError
	for 57014 errors.
	(pq_raise): If we are using an old server, use
	TransactionRollbackError if the error message contains "could not
	serialize" or "deadlock detected".

	* psycopg/psycopgmodule.c (_psyco_connect_fill_exc): remove
	function, since we no longer need to store pointers to the
	exceptions in the connection.  This also fixes a reference leak.
	(psyco_connect): remove _psyco_connect_fill_exc() function call.

	* psycopg/connection.h (connectionObject): remove exception
	members from struct.

	* psycopg/connection_type.c (connectionObject_getsets): modify the
	exception attributes on the connection object from members to
	getsets.  This reduces the size of the struct.

	* lib/extensions.py: import the two new extensions.

	* psycopg/psycopgmodule.c (exctable): add new QueryCanceledError
	and TransactionRollbackError exceptions.
2008-01-16 05:14:24 +00:00
Federico Di Gregorio
0422506404 Added name parameters to .cursor() calls in extras. 2007-09-01 09:32:42 +00:00
Federico Di Gregorio
a779c8ef99 .get_transaction_status() implementation. 2007-04-25 22:42:36 +00:00
Federico Di Gregorio
f43a52f781 Added RealDictCursor from #143. 2007-01-16 13:45:41 +00:00
Federico Di Gregorio
e59ef4de4b Moved SQL_IN to extensions and away from extras. 2007-01-16 10:58:05 +00:00
Federico Di Gregorio
bfe5b8fe6b Added iteritem method to DictRow. 2006-10-06 05:22:54 +00:00
Federico Di Gregorio
96f631d41e Merge from 2.0 branch up to r839. 2006-09-30 06:57:35 +00:00
Federico Di Gregorio
ca860424e6 Fixed lib/errorcodes.py. 2006-09-23 05:36:18 +00:00
Federico Di Gregorio
43518d067e Added lib/errorcodes.py. 2006-09-23 05:35:03 +00:00
Federico Di Gregorio
52666ef5bd Fixed syntax error in lib/extras.py. 2006-09-10 14:51:43 +00:00
Federico Di Gregorio
31189ef0df Fixed syntax error in extras module (closes: #123). 2006-09-10 14:50:03 +00:00
Federico Di Gregorio
269156d9bf Added some file-like attributes to lobject. 2006-09-02 05:33:03 +00:00
Federico Di Gregorio
64bd7ae61c Large objects landing.. 2006-09-02 04:57:50 +00:00
Federico Di Gregorio
36785f753b Work on large objects continue. 2006-09-01 17:15:27 +00:00
Federico Di Gregorio
64933f2004 Merge from 2_0_x branch up to r814. 2006-09-01 13:46:57 +00:00
Federico Di Gregorio
8eb118c63f Exposed connection status. 2006-09-01 08:20:11 +00:00
Federico Di Gregorio
38cf5f4520 Logging patch from Charlie. 2006-09-01 07:12:23 +00:00
Federico Di Gregorio
9299073649 First half of 8.1.4 securiy patch. 2006-05-24 09:43:55 +00:00
Federico Di Gregorio
27a063fecb DictCursor now support iteration. 2006-03-08 01:03:19 +00:00
Daniele Varrazzo
7f09080ba2 Tab removed 2006-01-21 04:09:11 +00:00
Federico Di Gregorio
81d86e9244 Logging connection/cursor implementation inspired by #90. 2006-01-20 04:07:23 +00:00
Daniele Varrazzo
202c002c5c * Docstrings added/fixed
* Added __all__ attributes to Python modules to explicit the package API
2006-01-12 18:36:57 +00:00
Federico Di Gregorio
1aed516938 Whitespace cleanup. 2006-01-06 02:58:24 +00:00
Daniele Varrazzo
3076046b3f * libpq.dll not used anymore. win32 setup uses pg_config too.
* Some typo fixed.
2006-01-05 16:56:40 +00:00
Federico Di Gregorio
5ea2fa636f Better DictCursor. 2005-12-06 05:55:58 +00:00
Daniele Varrazzo
ad76b5ba3c * psycopg/psycopgmodule.c: fixed exceptions refcount.
* fixed lots of doctrings and added Epydoc-generated docs support.
2005-11-26 07:47:48 +00:00
Daniele Varrazzo
62e4870b85 Fixed CLRF mix - trying with native eol 2005-11-24 04:22:35 +00:00
Daniele Varrazzo
1bac0484b5 Fixed a typo - but testing for SVN CRLF issues. 2005-11-24 04:16:41 +00:00
Federico Di Gregorio
f4fee20b3b In extensions.py: COMMITED -> COMMITTED. (Closes: #73) 2005-11-19 14:20:41 +00:00
Federico Di Gregorio
13a1dd197c Added warnings. 2005-11-15 16:21:55 +00:00
Federico Di Gregorio
96b2541939 Better fix for py2exe and related tools. 2005-11-15 16:05:15 +00:00
Federico Di Gregorio
f687f2853e Various pool changes. 2005-10-19 14:38:37 +00:00
Federico Di Gregorio
c7c2c38bcd Epydoc clean. :D 2005-10-18 05:57:02 +00:00
Federico Di Gregorio
0c67c641a8 Better docstrings for lib/ modules. 2005-10-18 05:42:00 +00:00
Federico Di Gregorio
06c8434520 Fixed typo in psycopg2.extensions. 2005-10-08 03:05:43 +00:00
Federico Di Gregorio
e1688431e0 Isolation level changes. 2005-10-08 03:04:40 +00:00
Federico Di Gregorio
a6b4a8b092 Indentation fixes. 2005-09-30 16:33:13 +00:00
Federico Di Gregorio
b7e5e5e272 piro pool.py patch. 2005-09-24 13:59:57 +00:00
Federico Di Gregorio
feeea0309a psycopg->psycopg2 fixes. 2005-09-12 02:29:46 +00:00
Federico Di Gregorio
5f00dc1100 Preparing release 2.0b4. 2005-07-17 04:08:08 +00:00
Federico Di Gregorio
5edfdc2a54 INTERVAL overflow fix. 2005-06-24 07:11:44 +00:00
Federico Di Gregorio
d7b10f4a9c psycopg1 .dictfetchone() fixed (closes #27). 2005-06-17 15:17:57 +00:00
Federico Di Gregorio
88f7ce153a Extra DictRow methods. 2005-05-19 04:48:26 +00:00
Federico Di Gregorio
35c42310ec DictRow fixes. 2005-05-10 02:29:24 +00:00
Federico Di Gregorio
431a2aec6c SGA-related changes. 2005-04-25 04:58:38 +00:00
Federico Di Gregorio
10dc03462b Little improvements to DictRow. 2005-04-11 07:20:46 +00:00
Federico Di Gregorio
728b4788de psycopg1 compatibility module (added autocommit.) 2005-04-03 06:16:24 +00:00
Federico Di Gregorio
fdb68599c7 psycopg1 compatibility module. 2005-04-03 06:13:24 +00:00
Federico Di Gregorio
19cb161d27 Array tokenization seems working. 2005-03-23 10:32:30 +00:00
Federico Di Gregorio
e5f558a6be COPY FROM works. 2005-03-01 16:41:02 +00:00
Federico Di Gregorio
cd672525e1 Adaptation fixes (a lot.) 2005-02-28 15:50:55 +00:00
Federico Di Gregorio
1ec3c83720 Temporary hack to make the AsIs adapter work (take 2.) 2005-02-28 09:16:49 +00:00
Federico Di Gregorio
ab02141d48 Temporary hack to make the AsIs adapter work. 2005-02-28 09:15:56 +00:00
Federico Di Gregorio
4b94e54473 Fixed example/myfirstrecipe.py 2005-02-27 15:03:53 +00:00
Federico Di Gregorio
1141149cd3 License changes. Fixes. Added register_adapter(). 2005-01-20 05:49:40 +00:00
Federico Di Gregorio
988095298e DictCursor fixes again. 2004-11-19 15:50:57 +00:00
Federico Di Gregorio
c904d97f69 Initial psycopg 2 import after SVN crash. 2004-10-19 03:17:12 +00:00