]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
3 years agoMerge remote-tracking branch 'origin/better-composite'
Daniele Varrazzo [Fri, 27 Aug 2021 22:23:27 +0000 (00:23 +0200)] 
Merge remote-tracking branch 'origin/better-composite'

3 years agoAdd binary composite dumper
Daniele Varrazzo [Thu, 26 Aug 2021 21:39:33 +0000 (23:39 +0200)] 
Add binary composite dumper

3 years agoDrop TypeInfo.async_fetch(), use fetch() for both connection types
Daniele Varrazzo [Thu, 26 Aug 2021 18:58:05 +0000 (20:58 +0200)] 
Drop TypeInfo.async_fetch(), use fetch() for both connection types

3 years agoA more elegant way to customise TypeInfo registration in subclasses
Daniele Varrazzo [Thu, 26 Aug 2021 18:18:57 +0000 (20:18 +0200)] 
A more elegant way to customise TypeInfo registration in subclasses

3 years agoMake register_composite(), register_range() the public interface
Daniele Varrazzo [Thu, 26 Aug 2021 17:46:53 +0000 (19:46 +0200)] 
Make register_composite(), register_range() the public interface

Drop subclassing of `TypeInfo.register()`, leaving it only for the base
task of registering type info and array. This makes them consistent with
other types which don't have a TypeInfo subclass of their own and only
expose a `register_*()` function (e.g. hstore).

3 years agoRegister composite dumper if the factory is a type
Daniele Varrazzo [Thu, 26 Aug 2021 15:24:26 +0000 (17:24 +0200)] 
Register composite dumper if the factory is a type

Expose the type as info.python_type after registering.

3 years agoClean up datetime adaptation docs
Daniele Varrazzo [Thu, 26 Aug 2021 12:51:08 +0000 (14:51 +0200)] 
Clean up datetime adaptation docs

3 years agoDon't use the generic name register_adapters
Daniele Varrazzo [Thu, 26 Aug 2021 02:54:24 +0000 (04:54 +0200)] 
Don't use the generic name register_adapters

There will be cases in which there is more than one type in the same
module...

3 years agoVerify that arrays of binary types dump correctly
Daniele Varrazzo [Thu, 26 Aug 2021 01:14:32 +0000 (03:14 +0200)] 
Verify that arrays of binary types dump correctly

3 years agoMore types adaptation docs
Daniele Varrazzo [Thu, 26 Aug 2021 01:13:56 +0000 (03:13 +0200)] 
More types adaptation docs

3 years agoDrop TODO doc point to something that people can discover themselves
Daniele Varrazzo [Wed, 25 Aug 2021 23:22:45 +0000 (01:22 +0200)] 
Drop TODO doc point to something that people can discover themselves

Let's leave devs some thrill, or this job becomes boring.

3 years agoAdd binary parameter to cursor.execute()
Daniele Varrazzo [Wed, 25 Aug 2021 17:57:46 +0000 (19:57 +0200)] 
Add binary parameter to cursor.execute()

3 years agoDrop Cursor.pgresult duplication in docs
Daniele Varrazzo [Wed, 25 Aug 2021 11:37:32 +0000 (13:37 +0200)] 
Drop Cursor.pgresult duplication in docs

Better style for Connection.pgconn docs. The old version of the cursor
attribute was better.

3 years agoDocument pgconn, pgresult properties
Daniele Varrazzo [Wed, 25 Aug 2021 02:58:24 +0000 (04:58 +0200)] 
Document pgconn, pgresult properties

3 years agoDon't use --no-deps to install the pool package
Daniele Varrazzo [Wed, 25 Aug 2021 02:05:12 +0000 (04:05 +0200)] 
Don't use --no-deps to install the pool package

It shouldn't be required at the moment, the package doesn't have any
dependency (although it does depend on psycopg).

3 years agoReadmes and metadata cleanup
Daniele Varrazzo [Wed, 25 Aug 2021 02:02:30 +0000 (04:02 +0200)] 
Readmes and metadata cleanup

3 years agoDrop TODO point after understanding that Windows has no IANA db
Daniele Varrazzo [Wed, 25 Aug 2021 01:02:54 +0000 (03:02 +0200)] 
Drop TODO point after understanding that Windows has no IANA db

3 years agoDrop TODO point regarding Travis
Daniele Varrazzo [Tue, 24 Aug 2021 21:08:29 +0000 (23:08 +0200)] 
Drop TODO point regarding Travis

On GitHub Action it's OK.

On flaky platforms these tests are skipped, so let's fail hard if the
proxy fails to come up.

3 years agoMerge branch 'array-delim'
Daniele Varrazzo [Wed, 25 Aug 2021 01:05:24 +0000 (03:05 +0200)] 
Merge branch 'array-delim'

3 years agoDump lists keeping the type delimiter into account
Daniele Varrazzo [Tue, 24 Aug 2021 20:55:09 +0000 (22:55 +0200)] 
Dump lists keeping the type delimiter into account

3 years agoLoad arrays of types with delimiters different than comma (e.g. box)
Daniele Varrazzo [Tue, 24 Aug 2021 19:14:50 +0000 (21:14 +0200)] 
Load arrays of types with delimiters different than comma (e.g. box)

3 years agoAdd "char" data type loading
Daniele Varrazzo [Tue, 24 Aug 2021 19:11:20 +0000 (21:11 +0200)] 
Add "char" data type loading

Not very used so won't implement it in C, but useful to read catalog
data.

3 years agoFix typeinfo fetch of alt_name
Daniele Varrazzo [Tue, 24 Aug 2021 19:08:43 +0000 (21:08 +0200)] 
Fix typeinfo fetch of alt_name

It was returned as the binary value of the oid number.

3 years agoAdd oid to column representation
Daniele Varrazzo [Tue, 24 Aug 2021 19:05:39 +0000 (21:05 +0200)] 
Add oid to column representation

4 years agoPlease mypy and NoReturn function
Daniele Varrazzo [Tue, 24 Aug 2021 20:59:58 +0000 (22:59 +0200)] 
Please mypy and NoReturn function

4 years agoDrop Cursor query, params attribute.
Daniele Varrazzo [Tue, 24 Aug 2021 17:05:50 +0000 (19:05 +0200)] 
Drop Cursor query, params attribute.

Document instead a `_query` object (renamed from the previous `_pgq`) as
helpful but subject to change.

4 years agoAdd cursor.statusmessage attribute
Daniele Varrazzo [Tue, 24 Aug 2021 16:34:38 +0000 (18:34 +0200)] 
Add cursor.statusmessage attribute

4 years agoDrop Cursor.status property
Daniele Varrazzo [Tue, 24 Aug 2021 15:58:34 +0000 (17:58 +0200)] 
Drop Cursor.status property

4 years agoRealign async copy tests to the sync ones
Daniele Varrazzo [Tue, 24 Aug 2021 15:54:47 +0000 (17:54 +0200)] 
Realign async copy tests to the sync ones

4 years agoDrop TODO point now working
Daniele Varrazzo [Tue, 24 Aug 2021 15:20:09 +0000 (17:20 +0200)] 
Drop TODO point now working

Add tests to prove it works.

4 years agoMore helpful error looking up for missing types in the registry
Daniele Varrazzo [Tue, 24 Aug 2021 15:18:30 +0000 (17:18 +0200)] 
More helpful error looking up for missing types in the registry

4 years agoDrop TODO point on which I'm wrong
Daniele Varrazzo [Tue, 24 Aug 2021 14:47:45 +0000 (16:47 +0200)] 
Drop TODO point on which I'm wrong

4 years agoDrop TODO point for something that probably can't be improved
Daniele Varrazzo [Tue, 24 Aug 2021 14:46:24 +0000 (16:46 +0200)] 
Drop TODO point for something that probably can't be improved

4 years agoAdd test for as_bytes method of sql objects
Daniele Varrazzo [Tue, 24 Aug 2021 14:22:16 +0000 (16:22 +0200)] 
Add test for as_bytes method of sql objects

4 years agoAdd links to GitHub tickets related to DSN mangling
Daniele Varrazzo [Tue, 24 Aug 2021 14:21:36 +0000 (16:21 +0200)] 
Add links to GitHub tickets related to DSN mangling

4 years agoAdd _get_connection_params method to connections
Daniele Varrazzo [Sat, 21 Aug 2021 12:39:36 +0000 (14:39 +0200)] 
Add _get_connection_params method to connections

Move there the connect_timeout extraction logic, but the method is
intended to do more elaboration on the parameters before connection,
which should include asynchronous DNS lookup and possibly SRV lookup
(RFC 2782) and allows overriding in subclasses to allow experimenting.

4 years agoBump to next dev version
Daniele Varrazzo [Tue, 24 Aug 2021 01:59:15 +0000 (03:59 +0200)] 
Bump to next dev version

4 years agoUse dev dependencies in tox checking 3.0.dev2
Daniele Varrazzo [Sun, 22 Aug 2021 13:44:32 +0000 (15:44 +0200)] 
Use dev dependencies in tox checking

Allow to specify a them in a single place and not having to repeat
package dependencies in the mypy test.

4 years agoLink mypy ignore comment to issue reported upstream
Daniele Varrazzo [Sat, 21 Aug 2021 15:32:32 +0000 (17:32 +0200)] 
Link mypy ignore comment to issue reported upstream

4 years agoFix building pool docs
Daniele Varrazzo [Sat, 21 Aug 2021 20:56:33 +0000 (22:56 +0200)] 
Fix building pool docs

4 years agoDrop ConnectionInfo.protocol_version.
Daniele Varrazzo [Mon, 2 Aug 2021 14:06:16 +0000 (16:06 +0200)] 
Drop ConnectionInfo.protocol_version.

Of limited utility. Left exposed in the underlying pgconn obecjt.

4 years agoMerge branch 'separate-pool'
Daniele Varrazzo [Sat, 21 Aug 2021 14:22:36 +0000 (16:22 +0200)] 
Merge branch 'separate-pool'

4 years agoDocument that the connection pool is in a separate package
Daniele Varrazzo [Sat, 21 Aug 2021 13:42:18 +0000 (15:42 +0200)] 
Document that the connection pool is in a separate package

4 years agoBuild the pool package and include it testing other packages
Daniele Varrazzo [Thu, 19 Aug 2021 23:15:20 +0000 (01:15 +0200)] 
Build the pool package and include it testing other packages

4 years agoMove the pool into a separate package
Daniele Varrazzo [Fri, 13 Aug 2021 13:09:38 +0000 (14:09 +0100)] 
Move the pool into a separate package

This would allow different release cycles from the core adapter.

4 years agoUpdate doc building requirements
Daniele Varrazzo [Sat, 21 Aug 2021 13:02:19 +0000 (15:02 +0200)] 
Update doc building requirements

Drop requirement file from makefile, long gone.
Update furo, as the theme selector was broken.

4 years agoMerge branch 'older-libpq'
Daniele Varrazzo [Sat, 21 Aug 2021 01:51:01 +0000 (03:51 +0200)] 
Merge branch 'older-libpq'

4 years agoRun windows tests in a way more similar to the built packages
Daniele Varrazzo [Sat, 21 Aug 2021 01:14:52 +0000 (03:14 +0200)] 
Run windows tests in a way more similar to the built packages

4 years agoAllow building the C module with older libpq versions
Daniele Varrazzo [Fri, 20 Aug 2021 00:46:45 +0000 (02:46 +0200)] 
Allow building the C module with older libpq versions

Mostly to work around the obsolete libpq version available for aarch64.

4 years agoMerge branch 'split-async'
Daniele Varrazzo [Sat, 21 Aug 2021 01:50:40 +0000 (03:50 +0200)] 
Merge branch 'split-async'

4 years agoasync_pool module renamed for consistency with other _async ones
Daniele Varrazzo [Fri, 13 Aug 2021 09:58:33 +0000 (10:58 +0100)] 
async_pool module renamed for consistency with other _async ones

4 years agoMove the AsyncCursor implementation in its own module
Daniele Varrazzo [Fri, 13 Aug 2021 09:55:59 +0000 (10:55 +0100)] 
Move the AsyncCursor implementation in its own module

4 years agoMove the AsyncConnection implementation in its own module
Daniele Varrazzo [Fri, 13 Aug 2021 09:45:18 +0000 (10:45 +0100)] 
Move the AsyncConnection implementation in its own module

4 years agoRevert commit 044077e420471e86b51f1feecdc5927818db55d4.
Daniele Varrazzo [Mon, 9 Aug 2021 14:39:24 +0000 (15:39 +0100)] 
Revert commit 044077e420471e86b51f1feecdc5927818db55d4.

4 years agoAdd @bloomberg sponsorship
Daniele Varrazzo [Sat, 7 Aug 2021 17:55:20 +0000 (18:55 +0100)] 
Add @bloomberg sponsorship

4 years agoMerge branch 'generic-row-factories'
Daniele Varrazzo [Thu, 5 Aug 2021 20:32:10 +0000 (21:32 +0100)] 
Merge branch 'generic-row-factories'

4 years agoSimplify rows example
Daniele Varrazzo [Thu, 5 Aug 2021 19:40:36 +0000 (20:40 +0100)] 
Simplify rows example

Use class_row instead of making your own, drop the recipe that has
become class_row itself.

4 years agoAdd psycopg.rows.args_row and kwargs_row factories
Daniele Varrazzo [Thu, 5 Aug 2021 19:39:57 +0000 (20:39 +0100)] 
Add psycopg.rows.args_row and kwargs_row factories

4 years agoEarly bailout style in the row factory functions
Daniele Varrazzo [Thu, 5 Aug 2021 16:50:15 +0000 (17:50 +0100)] 
Early bailout style in the row factory functions

4 years agoAdd class_row row factory generator
Daniele Varrazzo [Wed, 4 Aug 2021 13:49:14 +0000 (14:49 +0100)] 
Add class_row row factory generator

4 years agoMove dict/namedtuple row factory cursor inspection outside row maker
Daniele Varrazzo [Wed, 4 Aug 2021 01:47:26 +0000 (02:47 +0100)] 
Move dict/namedtuple row factory cursor inspection outside row maker

The list of fields names is supposed to be cached at every query result,
not at every row.

4 years agoFix description for cursors returning no column
Daniele Varrazzo [Wed, 4 Aug 2021 13:28:51 +0000 (14:28 +0100)] 
Fix description for cursors returning no column

4 years agoFix a typo in ConnectionInfo.dsn docstring
Denis Laxalde [Thu, 5 Aug 2021 06:45:50 +0000 (08:45 +0200)] 
Fix a typo in ConnectionInfo.dsn docstring

4 years agoAdd pgconn.encrypt_password function
Daniele Varrazzo [Mon, 2 Aug 2021 00:47:52 +0000 (02:47 +0200)] 
Add pgconn.encrypt_password function

4 years agoInclude the '()' in the links to the libpq functions
Daniele Varrazzo [Mon, 2 Aug 2021 12:29:42 +0000 (14:29 +0200)] 
Include the '()' in the links to the libpq functions

This is more consistent with the rest of the documentation.

4 years agoSome docs cleanup
Daniele Varrazzo [Mon, 2 Aug 2021 09:59:50 +0000 (11:59 +0200)] 
Some docs cleanup

4 years agoAdd ConnectionInfo.dsn property
Daniele Varrazzo [Mon, 2 Aug 2021 09:59:20 +0000 (11:59 +0200)] 
Add ConnectionInfo.dsn property

4 years agoFix returning connection params in get_parameters() with empty default
Daniele Varrazzo [Mon, 2 Aug 2021 09:34:01 +0000 (11:34 +0200)] 
Fix returning connection params in get_parameters() with empty default

"options" and "tty" were returned even if they were set to their
default.

4 years agoTest that the row_cursor param can be set explicitly to none
Daniele Varrazzo [Sun, 1 Aug 2021 23:43:25 +0000 (01:43 +0200)] 
Test that the row_cursor param can be set explicitly to none

4 years agoMake sure to store read_only and deferrable values as bool
Daniele Varrazzo [Sun, 1 Aug 2021 23:43:01 +0000 (01:43 +0200)] 
Make sure to store read_only and deferrable values as bool

4 years agoAdd test to verify errors in row factories are handled ok
Daniele Varrazzo [Sun, 1 Aug 2021 23:17:52 +0000 (01:17 +0200)] 
Add test to verify errors in row factories are handled ok

4 years agoFix a typo in transaction control docs
Denis Laxalde [Mon, 2 Aug 2021 09:56:40 +0000 (11:56 +0200)] 
Fix a typo in transaction control docs

4 years agoMerge branch 'async-row-factory'
Daniele Varrazzo [Sun, 1 Aug 2021 23:08:09 +0000 (01:08 +0200)] 
Merge branch 'async-row-factory'

4 years agoDrop AnyCursor from public interface
Daniele Varrazzo [Sun, 1 Aug 2021 20:33:44 +0000 (22:33 +0200)] 
Drop AnyCursor from public interface

Name repurposed internally for the generic to represent the type of
"self" in cursors.

4 years agoImprove rows docs
Daniele Varrazzo [Sun, 1 Aug 2021 19:55:56 +0000 (21:55 +0200)] 
Improve rows docs

4 years agoDrop row_factory from base connection class
Daniele Varrazzo [Sun, 1 Aug 2021 15:40:01 +0000 (17:40 +0200)] 
Drop row_factory from base connection class

Move it to the sync/async concrete classes, specifying the right type.

4 years agoAdd AsyncRowFactory class
Daniele Varrazzo [Sun, 1 Aug 2021 12:55:48 +0000 (14:55 +0200)] 
Add AsyncRowFactory class

The extra class allow clients to define their RowFactory just taking a
Cursor or an AsyncCursor, which is easier if the program handles only
one type of connection (sync or async).

Using a Generic, the server-side cursors are now subclassed from  the
respective client-side cursor (sync and async), which allows to drop a
bit of implementation duplication.

4 years agoAdd StrDumper to dump strings with text oid
Daniele Varrazzo [Fri, 30 Jul 2021 22:56:49 +0000 (00:56 +0200)] 
Add StrDumper to dump strings with text oid

4 years agoDon't clear the cursor state after closing
Daniele Varrazzo [Fri, 30 Jul 2021 19:14:58 +0000 (21:14 +0200)] 
Don't clear the cursor state after closing

It might be still useful to access the cursor state (e.g. rowcount, the
status message) after the cursor is closed, especially if the block
syntax is used.

Memory use is not really a problem: memory is cleared on GC anyway and
most functions using a cursor don't rely on the memory freed between
close() and the end of the function.

4 years agoIncrease tolerance in float4 tests
Daniele Varrazzo [Wed, 28 Jul 2021 16:50:57 +0000 (18:50 +0200)] 
Increase tolerance in float4 tests

The default tolerance is not quite enough on Postgres < 12 (e.g.
-13.633 != pytest.approx(-13.63298) with the default tolerance of 1e-6)

4 years agoAdd Float4/Float8 wrappers
Daniele Varrazzo [Wed, 28 Jul 2021 15:16:07 +0000 (17:16 +0200)] 
Add Float4/Float8 wrappers

Also improved numeric wrapper repr and made them lighter avoiding a dict
creation.

4 years agoSkip testing with lists of floats.
Daniele Varrazzo [Wed, 28 Jul 2021 13:27:19 +0000 (15:27 +0200)] 
Skip testing with lists of floats.

There might be rounding problems and problems with inf.

4 years agoFix Bit.io url in backers file
Daniele Varrazzo [Wed, 28 Jul 2021 11:41:10 +0000 (13:41 +0200)] 
Fix Bit.io url in backers file

4 years agoDocs pool cleanup
Daniele Varrazzo [Tue, 27 Jul 2021 19:51:36 +0000 (21:51 +0200)] 
Docs pool cleanup

4 years agoAllow some form of dumping lists of mixed types
Daniele Varrazzo [Mon, 26 Jul 2021 18:56:59 +0000 (20:56 +0200)] 
Allow some form of dumping lists of mixed types

Lists of numbers are now dumped as numeric[].

Default to dump text for arrays.

4 years agoAdd Error.sqlstate as a static attribute
Daniele Varrazzo [Mon, 26 Jul 2021 14:35:03 +0000 (16:35 +0200)] 
Add Error.sqlstate as a static attribute

Allow to lookup the mapping const name -> sqlstate too, and lookup is
case insensitive.

4 years agoFix quote of Binary wrapper
Daniele Varrazzo [Mon, 26 Jul 2021 00:53:18 +0000 (02:53 +0200)] 
Fix quote of Binary wrapper

4 years agoEmit quoted values valid for every standard_conforming_string value
Daniele Varrazzo [Mon, 26 Jul 2021 00:19:46 +0000 (02:19 +0200)] 
Emit quoted values valid for every standard_conforming_string value

Work around the unpredictable return value from the libpq.

4 years agoFix bytes quoting with non standard conforming strings
Daniele Varrazzo [Sun, 25 Jul 2021 19:26:12 +0000 (21:26 +0200)] 
Fix bytes quoting with non standard conforming strings

4 years agoMake sure the conn.autocommit attribute is set to a bool
Daniele Varrazzo [Sun, 25 Jul 2021 19:24:02 +0000 (21:24 +0200)] 
Make sure the conn.autocommit attribute is set to a bool

4 years agoFix docs typo
Daniele Varrazzo [Sun, 25 Jul 2021 19:23:52 +0000 (21:23 +0200)] 
Fix docs typo

4 years agoFix idempotence of server side cursors close()
Daniele Varrazzo [Sun, 25 Jul 2021 00:22:55 +0000 (02:22 +0200)] 
Fix idempotence of server side cursors close()

4 years agoMore readable field name in Column repr
Daniele Varrazzo [Sat, 24 Jul 2021 20:29:43 +0000 (22:29 +0200)] 
More readable field name in Column repr

4 years agoClear the caplog in retried tests
Daniele Varrazzo [Fri, 23 Jul 2021 21:32:37 +0000 (23:32 +0200)] 
Clear the caplog in retried tests

4 years agoDon't register any TypeInfo on oid 0
Daniele Varrazzo [Fri, 23 Jul 2021 20:59:44 +0000 (22:59 +0200)] 
Don't register any TypeInfo on oid 0

Someone may conceivably register info of an array only. Let's not
clobber INVALID_OID, I wouldn't know the side effects...

4 years agoDon't copy the types map from context to recursive dumpers
Daniele Varrazzo [Fri, 23 Jul 2021 16:45:11 +0000 (18:45 +0200)] 
Don't copy the types map from context to recursive dumpers

It can be accessed from the object's transformer.

4 years agoUse uppercase SQL throughout code and docs
Daniele Varrazzo [Fri, 23 Jul 2021 15:47:10 +0000 (17:47 +0200)] 
Use uppercase SQL throughout code and docs

I personally prefer lowercase, but uppercase is more familiar. There is
also a tiny advantage in greppability, in case someone tries to trace a
generated statement in the code.

The myth that using UPPERCASE the database will sense your urgency and
will run your queries faster has been dispelled.

4 years agoCache generated begin statement on the connection
Daniele Varrazzo [Fri, 23 Jul 2021 15:11:14 +0000 (17:11 +0200)] 
Cache generated begin statement on the connection

4 years agoAdd hstore adapters
Daniele Varrazzo [Fri, 16 Jul 2021 01:40:48 +0000 (03:40 +0200)] 
Add hstore adapters

4 years agoRespects transaction status of the connection used by TypeInfo.fetch
Daniele Varrazzo [Thu, 15 Jul 2021 11:34:22 +0000 (13:34 +0200)] 
Respects transaction status of the connection used by TypeInfo.fetch

Also make sure that the method returns None instead of throwing an
exception and leaving the connection broken in case the object is not
found.