]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
4 years agoAdd tuple_row test 32/head
Daniele Varrazzo [Wed, 24 Feb 2021 18:22:50 +0000 (19:22 +0100)] 
Add tuple_row test

4 years agoMake the nametuple_row() test independent from other tests
Daniele Varrazzo [Wed, 24 Feb 2021 18:19:16 +0000 (19:19 +0100)] 
Make the nametuple_row() test independent from other tests

4 years agoAdd test for row_factory with cursor.stream()
Daniele Varrazzo [Wed, 24 Feb 2021 18:07:21 +0000 (19:07 +0100)] 
Add test for row_factory with cursor.stream()

4 years agoOptimise the cython path around the use of row_maker
Daniele Varrazzo [Wed, 24 Feb 2021 15:50:00 +0000 (16:50 +0100)] 
Optimise the cython path around the use of row_maker

4 years agoMake cursor.row_factory writable
Daniele Varrazzo [Wed, 24 Feb 2021 15:14:13 +0000 (16:14 +0100)] 
Make cursor.row_factory writable

4 years agoMake the row_maker non-optional
Daniele Varrazzo [Wed, 24 Feb 2021 14:23:23 +0000 (15:23 +0100)] 
Make the row_maker non-optional

Use the `tuple` type as return value for `tuple_row()`, which has a
valid interface and can also be used in the Cython code to fast-path the
case where the tuples created internally are good enough.

4 years agoFix use of TypeInfo with connections using dict_row
Daniele Varrazzo [Wed, 24 Feb 2021 03:02:57 +0000 (04:02 +0100)] 
Fix use of TypeInfo with connections using dict_row

Actually always use dict_row as it makes things easier (we do create a
dict out of the query to pass kwargs...)

Relax the RowFactory signature to make it accept `dict_row()` and
`namedtuple_row()` too.

4 years agoFix type specification for `namedtuple_row()`
Daniele Varrazzo [Wed, 24 Feb 2021 02:11:26 +0000 (03:11 +0100)] 
Fix type specification for `namedtuple_row()`

4 years agoFix row factory docs examples
Daniele Varrazzo [Wed, 24 Feb 2021 02:09:26 +0000 (03:09 +0100)] 
Fix row factory docs examples

4 years agoMake the row_factory attribute non-nullable
Daniele Varrazzo [Wed, 24 Feb 2021 02:05:15 +0000 (03:05 +0100)] 
Make the row_factory attribute non-nullable

Added a `tuple_row()` factory for completeness. Note that it returns None, not
a callable, and the row_maker on the Transformer hasn't changed. The
signature of RowFactory now allows that.

This
makes simpler to specify the row_factory option on `conn.cursor()`: None
means default (the connection `row_factory`), specifying `tuple_row()`
overrides it to the normal tuplish behaviour.

4 years agoDrop row_factory param from Connection.execute()
Daniele Varrazzo [Wed, 24 Feb 2021 02:01:30 +0000 (03:01 +0100)] 
Drop row_factory param from Connection.execute()

The method is not present on cursor.execute: either it's on both or on
none. Erring on the side of a less complex interface for the moment...

4 years agoAdd namedtuple_row row factory
Denis Laxalde [Tue, 23 Feb 2021 17:52:12 +0000 (18:52 +0100)] 
Add namedtuple_row row factory

Implementation for namedtuple class cache and fields name sanitizing is
taken from psycogp2.

4 years agoDocument row factories
Denis Laxalde [Fri, 12 Feb 2021 14:55:14 +0000 (15:55 +0100)] 
Document row factories

We document the row_factory argument of *Connection.execute() as well as
the row_factory attribute on Connection.

We add a new page in advanced section explaining the concepts of row
factories, providing examples and documenting built-in row factories.

4 years agoStart a 'psycopg3.rows' module with dict_row()
Denis Laxalde [Fri, 12 Feb 2021 16:03:47 +0000 (17:03 +0100)] 
Start a 'psycopg3.rows' module with dict_row()

4 years agoAdd row_factory as connection attribute and connect argument
Denis Laxalde [Fri, 12 Feb 2021 09:31:30 +0000 (10:31 +0100)] 
Add row_factory as connection attribute and connect argument

When passing 'row_factory' to connect(), respective attribute will be
set on the connection instance. This will be used as default at cursor
creation and can be overridden with conn.cursor(row_factory=...) or
conn.execute(row_factory=...).

We use a '_null_row_factory' marker to handle None-value passed to
.cursor() or .execute() for disabling the default row factory.

4 years agoLet Transformer.make_row property's setter accept None
Denis Laxalde [Fri, 12 Feb 2021 08:34:46 +0000 (09:34 +0100)] 
Let Transformer.make_row property's setter accept None

4 years agoSet up row maker and loaders only once in a server-side cursor lifetime
Daniele Varrazzo [Fri, 12 Feb 2021 02:21:35 +0000 (03:21 +0100)] 
Set up row maker and loaders only once in a server-side cursor lifetime

It wasn't happening once per movement, as I was fearing, but it was happening
exactly twice: once on DECLARE, once on describe_portal(). We actually
don't care about the DECLARE result: it was being set on the cursor only
to detect errors, so now that's done manually.

4 years agoFix setting row maker on nextset()
Daniele Varrazzo [Fri, 12 Feb 2021 01:44:06 +0000 (02:44 +0100)] 
Fix setting row maker on nextset()

The test was broken and didn't test that the row_factory function was
really called.

4 years agoMerge branch 'master' into row-factory
Daniele Varrazzo [Fri, 12 Feb 2021 01:36:01 +0000 (02:36 +0100)] 
Merge branch 'master' into row-factory

4 years agoMerge branch 'tx-no-auto-loaders'
Daniele Varrazzo [Fri, 12 Feb 2021 01:27:58 +0000 (02:27 +0100)] 
Merge branch 'tx-no-auto-loaders'

4 years agoDon't recalculate loaders when not needed
Daniele Varrazzo [Fri, 12 Feb 2021 01:23:16 +0000 (02:23 +0100)] 
Don't recalculate loaders when not needed

The case it's not needed is when the new result is guaranteed to have
the same fields as the previous one. This happens querying in single-row
mode and on server-side cursors fetch.

4 years agoDropped Transformer.pgresult setter, use set_result
Daniele Varrazzo [Fri, 12 Feb 2021 01:08:18 +0000 (02:08 +0100)] 
Dropped Transformer.pgresult setter, use set_result

Can pass a boolean to tell it to skip setting row loaders

4 years agoFix fetch*() return type annotation on server-side cursors
Daniele Varrazzo [Thu, 11 Feb 2021 21:04:32 +0000 (22:04 +0100)] 
Fix fetch*() return type annotation on server-side cursors

4 years agoAdd tests to verify row_factory works with server-side cursors too
Daniele Varrazzo [Thu, 11 Feb 2021 20:59:03 +0000 (21:59 +0100)] 
Add tests to verify row_factory works with server-side cursors too

4 years agoMerge branch 'master' into row-factory
Daniele Varrazzo [Thu, 11 Feb 2021 20:54:11 +0000 (21:54 +0100)] 
Merge branch 'master' into row-factory

4 years agoMerge branch 'server-side-cursors'
Daniele Varrazzo [Thu, 11 Feb 2021 20:13:23 +0000 (21:13 +0100)] 
Merge branch 'server-side-cursors'

4 years agoTest server-side cursor hold
Daniele Varrazzo [Thu, 11 Feb 2021 19:42:22 +0000 (20:42 +0100)] 
Test server-side cursor hold

4 years agoDefault server-side cursor scrollable to not defined
Daniele Varrazzo [Thu, 11 Feb 2021 18:35:38 +0000 (19:35 +0100)] 
Default server-side cursor scrollable to not defined

4 years agoAdd documentation for the server-side cursors
Daniele Varrazzo [Thu, 11 Feb 2021 02:07:03 +0000 (03:07 +0100)] 
Add documentation for the server-side cursors

4 years agoAdd tests for cursor's row_factory with nextset()
Denis Laxalde [Thu, 11 Feb 2021 16:40:23 +0000 (17:40 +0100)] 
Add tests for cursor's row_factory with nextset()

4 years agoAdd row_factory argument to connection.execute()
Denis Laxalde [Thu, 11 Feb 2021 16:25:34 +0000 (17:25 +0100)] 
Add row_factory argument to connection.execute()

4 years agoMove the row maker as a Transformer attribute
Denis Laxalde [Thu, 11 Feb 2021 11:22:32 +0000 (12:22 +0100)] 
Move the row maker as a Transformer attribute

Instead of carrying the row maker (_make_row attribute) on the cursor
and possibly calling it to transform each row in cursor methods, we
define a 'make_row' attribute on Transformer that is possibly used in
load_row() and load_rows().

In the Python implementation of Transformer.load_rows(), we use tuple as
as make_row() when the attribute is unset.

In the Cython implementation, we make 'make_row' a plain property with a
'_make_row' attribute under the hood. We finally transform individual or
list of records using self.make_row().

4 years agoAdd constraints to the Row type variable
Denis Laxalde [Thu, 11 Feb 2021 11:22:32 +0000 (12:22 +0100)] 
Add constraints to the Row type variable

We constrain Row to be either a Tuple[Any, ...] (for the case no row
factory is in use) or Any (otherwise).

This avoids the artificial cast() in cursor code and will make changes
in followup commits much easier.

4 years agoUse no row factory in TypeInfo.fetch*()
Denis Laxalde [Thu, 11 Feb 2021 15:15:23 +0000 (16:15 +0100)] 
Use no row factory in TypeInfo.fetch*()

TypeInfo.fetch() and TypeInfo.fetch_async() delegate results processing
to TypeInfo._fetch() which only handle results as tuples. Therefore, we
build the cursor with no row factory to guarantee this. Still we need to
add a type hint on 'recs' variable because this cannot be inferred (this
fixes the mypy error introduced in previous commits).

4 years agoMake sue ServerCursor.execute() can be used more than once
Daniele Varrazzo [Wed, 10 Feb 2021 17:50:03 +0000 (18:50 +0100)] 
Make sue ServerCursor.execute() can be used more than once

4 years agoDon't clobber error leaving a ServerCursor block with a broken connection
Daniele Varrazzo [Wed, 10 Feb 2021 17:49:06 +0000 (18:49 +0100)] 
Don't clobber error leaving a ServerCursor block with a broken connection

4 years agoMake row factory optional
Denis Laxalde [Wed, 10 Feb 2021 16:58:42 +0000 (17:58 +0100)] 
Make row factory optional

We change the default value of row_factory argument in
connection.cursor() to None and thus use a keyword argument.

On cursor side, we only set the '_make_row' attribute if a 'row_factory'
got passed and we guard all possible calls to _make_row() by an
'if self._make_row' to avoid a Python call per row. Note that, on the
other hand, we now need to cast 'row' values to the 'Row' type in order
to satisfy type checking.

The default_row_factory() is now useless and thus dropped.

4 years agoAdd name to the ServerCursor repr()
Daniele Varrazzo [Wed, 10 Feb 2021 15:28:05 +0000 (16:28 +0100)] 
Add name to the ServerCursor repr()

4 years agoOf of fixing typos
Daniele Varrazzo [Wed, 10 Feb 2021 15:02:42 +0000 (16:02 +0100)] 
Of of fixing typos

4 years agoNamedCursor renamed to ServerCursor
Daniele Varrazzo [Wed, 10 Feb 2021 14:56:37 +0000 (15:56 +0100)] 
NamedCursor renamed to ServerCursor

In psycopg2 they are not a separate class as they are in psycopg3.

They still need a mandatory name, but having a name is not their
defining trait.

4 years agoSpecify keyword-only args on Connection and Cursor execute()
Daniele Varrazzo [Wed, 10 Feb 2021 14:38:22 +0000 (15:38 +0100)] 
Specify keyword-only args on Connection and Cursor execute()

4 years agoTypo fix
Daniele Varrazzo [Wed, 10 Feb 2021 14:33:33 +0000 (15:33 +0100)] 
Typo fix

4 years agoAdd test for all the documented NamedCursor interface
Daniele Varrazzo [Wed, 10 Feb 2021 14:30:27 +0000 (15:30 +0100)] 
Add test for all the documented NamedCursor interface

4 years agoFix docs after AsyncConnection.cursor() made non-async
Daniele Varrazzo [Wed, 10 Feb 2021 13:41:32 +0000 (14:41 +0100)] 
Fix docs after AsyncConnection.cursor() made non-async

4 years agoIntroduce row_factory option in connection.cursor()
Denis Laxalde [Tue, 9 Feb 2021 15:51:11 +0000 (16:51 +0100)] 
Introduce row_factory option in connection.cursor()

We add a row_factory keyword argument in connection.cursor() and cursor
classes that will be used to produce individual rows of the result set.

A RowFactory can be implemented as a class with a __call__ method
accepting raw values and initialized with a cursor instance; the
RowFactory instance is created when results are available. Type
definitions for RowFactory (and its respective RowMaker) are defined as
callback protocols so as to allow user to define a row factory without
the need for writing a class.

The default row factory returns values unchanged.

4 years agoAsyncConnection.cursor() is no more async
Daniele Varrazzo [Wed, 10 Feb 2021 02:31:14 +0000 (03:31 +0100)] 
AsyncConnection.cursor() is no more async

Even after implementing server-side cursors there is not really a reason
for it to be.

4 years agoClose correctly named cursors in corner cases
Daniele Varrazzo [Wed, 10 Feb 2021 02:04:00 +0000 (03:04 +0100)] 
Close correctly named cursors in corner cases

4 years agoMake sure you can use a named cursor to "steal" a portal
Daniele Varrazzo [Wed, 10 Feb 2021 01:47:45 +0000 (02:47 +0100)] 
Make sure you can use a named cursor to "steal" a portal

4 years agoAdd docs for Cursor.scroll()
Daniele Varrazzo [Wed, 10 Feb 2021 01:18:51 +0000 (02:18 +0100)] 
Add docs for Cursor.scroll()

4 years agoAdd scrollable tests
Daniele Varrazzo [Wed, 10 Feb 2021 01:05:31 +0000 (02:05 +0100)] 
Add scrollable tests

4 years agoAdd named cursor scroll
Daniele Varrazzo [Wed, 10 Feb 2021 00:49:41 +0000 (01:49 +0100)] 
Add named cursor scroll

4 years agoAdd cursor.scroll()
Daniele Varrazzo [Wed, 10 Feb 2021 00:26:08 +0000 (01:26 +0100)] 
Add cursor.scroll()

4 years agoFix rownumber during iteration in named cursors
Daniele Varrazzo [Tue, 9 Feb 2021 22:53:54 +0000 (23:53 +0100)] 
Fix rownumber during iteration in named cursors

4 years agoAdd fetch methods to named cursors
Daniele Varrazzo [Tue, 9 Feb 2021 20:04:00 +0000 (21:04 +0100)] 
Add fetch methods to named cursors

4 years agoAdd Cursor.rownumber attribute
Daniele Varrazzo [Tue, 9 Feb 2021 17:47:41 +0000 (18:47 +0100)] 
Add Cursor.rownumber attribute

4 years agoDelete the Postgres cursor when closing a named cursor
Daniele Varrazzo [Tue, 9 Feb 2021 14:06:06 +0000 (15:06 +0100)] 
Delete the Postgres cursor when closing a named cursor

4 years agoAdded classes for named cursors
Daniele Varrazzo [Tue, 9 Feb 2021 03:22:01 +0000 (04:22 +0100)] 
Added classes for named cursors

Only execute implemented, with a describe roundtrip to get the
portal description.

4 years agoAdded pgconn.send_describe_prepared, send_describe_portal
Daniele Varrazzo [Tue, 9 Feb 2021 00:52:50 +0000 (01:52 +0100)] 
Added pgconn.send_describe_prepared, send_describe_portal

4 years agoYou don't want a psycoGP, no
Daniele Varrazzo [Tue, 9 Feb 2021 00:17:58 +0000 (01:17 +0100)] 
You don't want a psycoGP, no

4 years agoAdded set_jsonb_loads/dumps functions to customise JSON adaptation
Daniele Varrazzo [Mon, 8 Feb 2021 22:56:22 +0000 (23:56 +0100)] 
Added set_jsonb_loads/dumps functions to customise JSON adaptation

Dropped dumps function from the Json/Jsonb wrappers.

Added JSON documentation.

4 years agoAdd some docs on TypeInfo and adaptation docs corrections
Daniele Varrazzo [Mon, 8 Feb 2021 01:42:31 +0000 (02:42 +0100)] 
Add some docs on TypeInfo and adaptation docs corrections

4 years agoExpose TypeInfo objects from the `psycopg3.types` package
Daniele Varrazzo [Mon, 8 Feb 2021 01:37:57 +0000 (02:37 +0100)] 
Expose TypeInfo objects from the `psycopg3.types` package

4 years agoRegister arrays using the TypeInfo object
Daniele Varrazzo [Sat, 6 Feb 2021 03:14:43 +0000 (04:14 +0100)] 
Register arrays using the TypeInfo object

TypeInfo and subclasses implementations moved together to a dedicated module,
sharing more uniform interface and implementation.

4 years agoAllow mypy to run from root dir
Daniele Varrazzo [Fri, 5 Feb 2021 12:42:14 +0000 (13:42 +0100)] 
Allow mypy to run from root dir

4 years agoAdded @healthchecks, @ferpection, @abegerho to the backers file
Daniele Varrazzo [Fri, 5 Feb 2021 10:52:30 +0000 (11:52 +0100)] 
Added @healthchecks, @ferpection, @abegerho to the backers file

Thank you very much :)

4 years agoDetect the range oid from the subtype for non-builtins too
Daniele Varrazzo [Fri, 5 Feb 2021 02:45:05 +0000 (03:45 +0100)] 
Detect the range oid from the subtype for non-builtins too

4 years agoAdd AdaptersMap.types map
Daniele Varrazzo [Fri, 5 Feb 2021 02:13:23 +0000 (03:13 +0100)] 
Add AdaptersMap.types map

Use the map from the adapters when it's needed to look up for a type
info.

Probably there are other places where to make use of it.

4 years agoAdd py.typed marker file to installed package
Daniele Varrazzo [Thu, 4 Feb 2021 03:17:35 +0000 (04:17 +0100)] 
Add py.typed marker file to installed package

4 years agoProud to have @yougov backing us!
Daniele Varrazzo [Tue, 26 Jan 2021 13:22:41 +0000 (14:22 +0100)] 
Proud to have @yougov backing us!

4 years agoFixed comment
Daniele Varrazzo [Tue, 26 Jan 2021 13:16:50 +0000 (14:16 +0100)] 
Fixed comment

4 years agoFixed dumping of integer ranges
Daniele Varrazzo [Sat, 23 Jan 2021 01:49:14 +0000 (02:49 +0100)] 
Fixed dumping of integer ranges

4 years agoDump time and timestamp naive and tz-aware with the respective oids
Daniele Varrazzo [Fri, 22 Jan 2021 21:30:08 +0000 (22:30 +0100)] 
Dump time and timestamp naive and tz-aware with the respective oids

Using the tz version of the data types is ok enough for most uses,
because Postgres can downgrade the type to naive, but ranges don't have
an implicit cast and the exact type of the range subtype is necessary.

4 years agoHave a single Range class, not one per subtype
Daniele Varrazzo [Thu, 21 Jan 2021 03:05:33 +0000 (04:05 +0100)] 
Have a single Range class, not one per subtype

There are two problems here, so this doesn't work. One, which will be
solved, is to have a registry of types attached to an adaptation
context: a TODO in already several places, so this will be solved.
Before that we don't really have a way to find back e.g. the oid of a
custom range on strings starting from Range('a', 'b').

The second problem, more serious, is that Postgres doesn't cast
int4range <-> int8range and tsrange <-> tstzrange. The latter pair can
be solved with a two steps dumper choosing between tz aware and not. The
first I don't have in mind how to solve it: Given Range(1,2) I wouldn't
know if int4 or int8 should be used, and Postgres doesn't seem very
forgiving. Probably we should go unknown.

4 years agoAdded docs for AsyncCursor.stream()
Daniele Varrazzo [Fri, 22 Jan 2021 18:04:14 +0000 (19:04 +0100)] 
Added docs for AsyncCursor.stream()

4 years agoMypy version bumped to 0.800
Daniele Varrazzo [Fri, 22 Jan 2021 17:39:52 +0000 (18:39 +0100)] 
Mypy version bumped to 0.800

4 years agoAdded Cursor.stream() to support fetch in single-row mode
Daniele Varrazzo [Fri, 22 Jan 2021 03:05:12 +0000 (04:05 +0100)] 
Added Cursor.stream() to support fetch in single-row mode

4 years agoAdded a few docstrings on types registry
Daniele Varrazzo [Thu, 21 Jan 2021 03:04:09 +0000 (04:04 +0100)] 
Added a few docstrings on types registry

4 years agoRun black on the builtin oids
Daniele Varrazzo [Thu, 21 Jan 2021 03:02:03 +0000 (04:02 +0100)] 
Run black on the builtin oids

4 years agoArray dumper ligtened up
Daniele Varrazzo [Thu, 21 Jan 2021 02:57:08 +0000 (03:57 +0100)] 
Array dumper ligtened up

Don't fetch a string dumper on init, dropped sub_oid attribute.

4 years agoAdded two-steps dumpers implementation in C too
Daniele Varrazzo [Wed, 20 Jan 2021 17:25:05 +0000 (18:25 +0100)] 
Added two-steps dumpers implementation in C too

4 years agoDon't require a Transformer roundtrip to choose the specific int dumper
Daniele Varrazzo [Wed, 20 Jan 2021 12:23:06 +0000 (13:23 +0100)] 
Don't require a Transformer roundtrip to choose the specific int dumper

They are static object, they require no customisation with the
connection. I don't expect anyone wanting to subclass them; if they
do they will deal with the whole 5 objects.

4 years agoAdded test to verify queries failing if int is dumped as int8 or numeric
Daniele Varrazzo [Wed, 20 Jan 2021 01:56:52 +0000 (02:56 +0100)] 
Added test to verify queries failing if int is dumped as int8 or numeric

I wanted these so badly.

4 years agoAdapt the dumper used to the value of the objects
Daniele Varrazzo [Wed, 20 Jan 2021 01:46:45 +0000 (02:46 +0100)] 
Adapt the dumper used to the value of the objects

Added a second dispatch to allow a dumper to upgrade to a specialised
version. Currently used to dump int to the smallest Postgres type
holding that value and to dump lists of object into typed arrays.

This change allows to write queries more naturally as no ``::int`` cast
should be needed anymore e.g. in date + int or jsonb ->> int.

Only Python implementation; C version to be implemented yet.

4 years agoUse prepared statements machinery for executemany
Daniele Varrazzo [Tue, 19 Jan 2021 17:29:12 +0000 (18:29 +0100)] 
Use prepared statements machinery for executemany

Don't use the anonymous prepared statement anymore, as it doesn't allow
to manage different types.

4 years agoCopyright year bumped
Daniele Varrazzo [Sun, 17 Jan 2021 06:49:38 +0000 (07:49 +0100)] 
Copyright year bumped

egg-info dirs ignored from the root gitignore file to help ag to skpt
them.

Command used:

    ag -l copyright | xargs sed -i "s/\(.*copyright[^0-9]*\)\([0-9]\+\)\(-[0-9]\+\)\?\(.*Psycopg.*\)/\1\2-$(date +%Y)\4/I"

4 years agoMore uniform names for internal objects
Daniele Varrazzo [Sun, 17 Jan 2021 06:19:40 +0000 (07:19 +0100)] 
More uniform names for internal objects

4 years agoAdded tests to detect leaks on copy from
Daniele Varrazzo [Sat, 16 Jan 2021 02:51:19 +0000 (03:51 +0100)] 
Added tests to detect leaks on copy from

4 years agoAdded leak test for async cursor
Daniele Varrazzo [Sat, 16 Jan 2021 02:35:20 +0000 (03:35 +0100)] 
Added leak test for async cursor

Leak and correctness tests separated.

4 years agoAdded random tests for data copy
Daniele Varrazzo [Sat, 16 Jan 2021 02:34:32 +0000 (03:34 +0100)] 
Added random tests for data copy

4 years agoDeclare all loaders to receive an object supporting the buffer interface
Daniele Varrazzo [Sat, 16 Jan 2021 02:06:56 +0000 (03:06 +0100)] 
Declare all loaders to receive an object supporting the buffer interface

There isn't in mypy such an object, so just use `Union[bytes, bytearray,
memoryview]`

Avoid a memory copy passing data from the Transformer to the loaders.

I had started exercising this code path by adding copy tests, but after
dropping the extra copy the same path is now exercised by any select, so
I've stopped doing that.

4 years agoAllow passing a list of names to copy.set_types()
Daniele Varrazzo [Fri, 15 Jan 2021 23:35:56 +0000 (00:35 +0100)] 
Allow passing a list of names to copy.set_types()

Also improved TypeRegistry by recognising a type name even if includes
the array marker '[]' and added get_oid() function.

No test for this object as it's considered internal and leveraged by
several other tests, but I'm sure I will regret it.

4 years agoDon't clobber the exception on rollback error in connection exit
Daniele Varrazzo [Fri, 15 Jan 2021 22:23:35 +0000 (23:23 +0100)] 
Don't clobber the exception on rollback error in connection exit

4 years agoBetter integration between C copy functions and C transformer
Daniele Varrazzo [Fri, 15 Jan 2021 17:26:04 +0000 (18:26 +0100)] 
Better integration between C copy functions and C transformer

4 years agoAdded copy Format helpers to handle text/binary differences
Daniele Varrazzo [Fri, 15 Jan 2021 17:09:45 +0000 (18:09 +0100)] 
Added copy Format helpers to handle text/binary differences

4 years agoAdded parallel worker to COPY FROM
Daniele Varrazzo [Fri, 15 Jan 2021 13:55:29 +0000 (14:55 +0100)] 
Added parallel worker to COPY FROM

Have a background writer to push data down the connection while the main
thread is CPU-bound to encode data.

Use a thread to implement the sync worker, a task to implement the
asyncio one.

4 years agoEnd-of-copy logic moved from exit to finish gen
Daniele Varrazzo [Fri, 15 Jan 2021 01:54:50 +0000 (02:54 +0100)] 
End-of-copy logic moved from exit to finish gen

4 years agoAdded some docs about binary parameters/values.
Daniele Varrazzo [Thu, 14 Jan 2021 23:31:21 +0000 (00:31 +0100)] 
Added some docs about binary parameters/values.

4 years agoDropped format argument to cursor: use binary= instead
Daniele Varrazzo [Thu, 14 Jan 2021 22:40:03 +0000 (23:40 +0100)] 
Dropped format argument to cursor: use binary= instead

This should make pretty unneeded to import the Format object in client
code.

4 years agoDefine MAXINT8LEN as a constant
Daniele Varrazzo [Thu, 14 Jan 2021 21:31:15 +0000 (22:31 +0100)] 
Define MAXINT8LEN as a constant

4 years agoDropped intermediate dumpers cache in C transformer too
Daniele Varrazzo [Thu, 14 Jan 2021 19:45:00 +0000 (20:45 +0100)] 
Dropped intermediate dumpers cache in C transformer too