]>
git.ipfire.org Git - thirdparty/psycopg.git/log
Daniele Varrazzo [Sun, 5 Feb 2023 18:34:47 +0000 (19:34 +0100)]
fix(c): massage the queries module until it compiles and passes tests
Daniele Varrazzo [Sun, 5 Feb 2023 18:28:31 +0000 (19:28 +0100)]
refactor: add a facade internal module where to find query objects
Daniele Varrazzo [Sun, 5 Feb 2023 12:08:17 +0000 (13:08 +0100)]
refactor: use a suffix instead of a prefix for the python implementation module
This keeps the module next to its facade in files lists.
Daniele Varrazzo [Sun, 5 Feb 2023 11:48:04 +0000 (12:48 +0100)]
fix(c): fix imports in queries module to allow importing the extension
zamnedix [Fri, 23 Dec 2022 15:26:28 +0000 (10:26 -0500)]
feat(c): add queries C module
Denis Laxalde [Wed, 17 Aug 2022 13:59:31 +0000 (15:59 +0200)]
test: use anyio instead of pytest-asyncio
This is in preparation for adding support for other async libraries,
through anyio. AnyIO pytest plugin is used in replacement for
pytest-asyncio:
- either the pytest.mark.asyncio is replaced by pytest.mark.anyio, or,
- we rely on the 'anyio_backend' fixture that is pulled in 'aconn_cls'
fixture (and hence 'aconn') providing automatic detection for test
functions using it.
The 'anyio_backend' fixture is parametrized to only use asyncio and
selects the event loop policy we need on Windows platform as previously
done in pytest_sessionstart(), but only for Python version 3.8 or
higher.
This fixture is defined in main conftest.py, as well as in
pool/conftest.py since we'll change the former to support more async
backend while keeping the later asyncio-only for now.
Function test_concurrency_async.py::test_ctrl_c is no longer 'async'
because its code does not directly use asyncio (it's done through a
subprocess); but the 'async def' was needed before in order for
pytest-asyncio to run it since the test module had a global
pytest.mark.asyncio (and we were using the "auto" mode).
Daniele Varrazzo [Sat, 4 Feb 2023 11:32:09 +0000 (12:32 +0100)]
Merge branch 'set-results'
Denis Laxalde [Tue, 24 Jan 2023 15:18:24 +0000 (16:18 +0100)]
refactor: set cursor result in _maybe_prepare_gen()
When not in pipeline mode, we can actually set the results on the cursor
directly in this method instead of letting the caller handle this.
Denis Laxalde [Mon, 9 Jan 2023 20:26:46 +0000 (21:26 +0100)]
refactor: merge BaseCursor's _set_results() and _set_results_from_pipeline()
Per refactoring of previous commits, these are similar: the only
difference is the use of "first_batch" flag in the execute() branch when
not in pipeline mode, but in that case since there is actually only one
"batch", the behavior is actually preserved.
Since _set_results_from_pipeline() previously included a call to
_check_results() but _set_results() does not, that is reported in caller
(BasePipeline._process_results()).
Denis Laxalde [Sat, 7 Jan 2023 07:49:16 +0000 (08:49 +0100)]
refactor: handle returning-executemany() in _set_results()
Denis Laxalde [Sat, 7 Jan 2023 07:31:41 +0000 (08:31 +0100)]
refactor: introduce BaseCursor._set_results()
Similar to _set_results_from_pipeline(), this applies to the
non-pipeline case and reduce code repetition.
Daniele Varrazzo [Sat, 4 Feb 2023 11:13:16 +0000 (12:13 +0100)]
Merge branch 'sqlalchemy_pipeline'
Daniele Varrazzo [Sat, 4 Feb 2023 10:15:55 +0000 (11:15 +0100)]
ci: add colors to pytest sqlalchemy run
Daniele Varrazzo [Sat, 4 Feb 2023 10:08:48 +0000 (11:08 +0100)]
ci: allow better job visualization in Action page
Daniele Varrazzo [Sat, 4 Feb 2023 10:05:11 +0000 (11:05 +0100)]
ci: fix postgres service in 3rd party workflow
Federico Caselli [Tue, 17 Jan 2023 21:51:02 +0000 (22:51 +0100)]
ci: add sqlalchemy integration pipeline
Daniele Varrazzo [Sat, 4 Feb 2023 09:48:08 +0000 (10:48 +0100)]
Merge branch 'fix-503'
Daniele Varrazzo [Wed, 1 Feb 2023 01:08:33 +0000 (02:08 +0100)]
docs: add news entry about TypeInfo.fetch() with sql_ascii connection fix
Daniele Varrazzo [Wed, 1 Feb 2023 01:04:04 +0000 (02:04 +0100)]
test: test hstore registration using different encodings
Reproduce the "emerging" bug reported in #503.
Daniele Varrazzo [Wed, 1 Feb 2023 00:59:01 +0000 (01:59 +0100)]
fix: fix TypeInfo.fetch() with a sql_ascii encoding connection
Close #503
Daniele Varrazzo [Wed, 1 Feb 2023 00:52:57 +0000 (01:52 +0100)]
test: add TypeInfo.fetch() test with autocommit transaction
Daniele Varrazzo [Wed, 1 Feb 2023 00:39:51 +0000 (01:39 +0100)]
test: reproduce the error in TypeInfo.fetch() in sql_ascii connection
Reported in #503.
Harry Lees [Fri, 3 Feb 2023 11:57:50 +0000 (11:57 +0000)]
fixed broken link to pip docs
Daniele Varrazzo [Wed, 1 Feb 2023 10:25:26 +0000 (11:25 +0100)]
chore: upgrade black to 23.1.0
Code reformatted to adhere to the new style requested (stricter on
redundant tuples unpacking brackets and blank lines at blocks start).
Daniele Varrazzo [Sat, 28 Jan 2023 16:52:26 +0000 (17:52 +0100)]
chore: bump psycopg_pool package version to 3.1.6
Daniele Varrazzo [Mon, 16 Jan 2023 21:53:48 +0000 (22:53 +0100)]
chore: bump psycopg package version to 3.1.8
Daniele Varrazzo [Tue, 17 Jan 2023 01:38:35 +0000 (02:38 +0100)]
ci: bump to PostgreSQL 15 on macOS package build
Try to do without brew update, which at the moment downloads half a
million of packages we don't use and then barfs on some java crap.
Daniele Varrazzo [Mon, 16 Jan 2023 23:58:15 +0000 (00:58 +0100)]
chore: bump cibuildwheel to 2.12.0
Checking if this fixes the current error in Github Actions, where the
macOS builds fail on `brew update`.
Daniele Varrazzo [Sat, 28 Jan 2023 16:48:28 +0000 (17:48 +0100)]
Merge branch 'kwargs-begone'
Daniele Varrazzo [Sat, 28 Jan 2023 16:46:33 +0000 (17:46 +0100)]
docs(pool): mention change in constructors signatures in the news
Ran Benita [Tue, 24 Jan 2023 20:59:55 +0000 (22:59 +0200)]
refactor(pool): make constructor configuration parameters type-safe
Previously, arguments to ConnectionPool and friends would be forwarded
using `**kwargs` to `BasePool`. This is however not type-safe, and
prevents code editors from auto-completing the parameters.
Drop the `**kwargs`, duplicate the parameters instead.
Fixes #493.
Daniele Varrazzo [Mon, 16 Jan 2023 21:50:58 +0000 (22:50 +0100)]
Merge pull request #484 from apollo13/typeinfo-for-clientcusor
Fixed TypeInfo for ClientCursor.
Florian Apolloner [Mon, 16 Jan 2023 20:09:21 +0000 (21:09 +0100)]
Fixed TypeInfo for ClientCursor.
TypeInfo had a hardcoded binary=True which doesn't work to well for
ClientCursor.
Daniele Varrazzo [Mon, 9 Jan 2023 17:44:23 +0000 (17:44 +0000)]
Merge branch 'refactor-typeinfo'
Daniele Varrazzo [Fri, 6 Jan 2023 17:55:44 +0000 (17:55 +0000)]
refactor: break circular import problem between sql, adapt, _typeinfo
Move the implementation of the Python Transformer to a further internal
module, which is only imported if the Python implementation is used.
The new module breaks the dependency of sql on adapt without introducing
a lazy import. Drop all the lazy imports required to work around the
above.
Daniele Varrazzo [Fri, 6 Jan 2023 16:53:36 +0000 (16:53 +0000)]
refactor: move TypeInfo subclasses to the module they are exported from
Daniele Varrazzo [Fri, 6 Jan 2023 14:36:45 +0000 (14:36 +0000)]
refactor: drop use of `postgres.types` to know OIDs at import time
Daniele Varrazzo [Fri, 6 Jan 2023 14:16:39 +0000 (14:16 +0000)]
style: blank line after the autogenerated section
Daniele Varrazzo [Fri, 6 Jan 2023 14:11:24 +0000 (14:11 +0000)]
refactor: import OID constants from the _oids module
Daniele Varrazzo [Fri, 6 Jan 2023 14:03:12 +0000 (14:03 +0000)]
feat: add _oid module to know OIDs at import time
Daniele Varrazzo [Fri, 6 Jan 2023 13:53:14 +0000 (13:53 +0000)]
refactor(crdb): only expose register_crdb_adapters()
Other functions are just an internal arrangement.
Daniele Varrazzo [Mon, 9 Jan 2023 17:41:57 +0000 (17:41 +0000)]
Merge pull request #479 from dlax/rowcount
Denis Laxalde [Sat, 7 Jan 2023 15:01:36 +0000 (16:01 +0100)]
fix: set rowcount to the first result in executemany(..., returning=True)
Previously, _rowcount was unconditionally set to the overall number of
rows of all queries in executemany() and then reset only upon the first
call to nextset(). In the returning=True case, this lead the rowcount
attribute to be wrong for the first result (i.e. it didn't match the
number of rows that would be returned by .fetchall(), as can be seen in
updated tests).
Now we only set _rowcount to the cumulated number of rows of executed
queries *if* executemany() is not returning (so the value is still
useful, e.g., in to check the number of INSERTed rows):
>>> cur.executemany("INSERT INTO t(r) VALUES (%s)", [(1,), (2,)])
>>> cur.rowcount
2 # number of inserted rows
>>> cur.nextset()
>>> cur.executemany("INSERT INTO t(r) VALUES (%s) RETURNING r", [(1,), (2,)], returning=True)
>>> cur.rowcount
1 # number of rows in the first result set
>>> cur.fetchall()
[(1,)]
>>> cur.nextset()
True
>>> cur.rowcount
1
>>> cur.fetchall()
[(2,)]
>>> cur.nextset()
Besides, the code for processing results from executemany() in
_executemany_gen_no_pipeline() is now similar to that of
_set_results_from_pipeline().
Daniele Varrazzo [Sun, 8 Jan 2023 19:38:11 +0000 (19:38 +0000)]
Merge pull request #478 from dlax/old-libpq-in-ci
Install the "oldest" libpq from pgdg repository
Denis Laxalde [Sun, 8 Jan 2023 14:48:38 +0000 (15:48 +0100)]
refactor: drop superfluous _rowcount reset
In BaseCursor._set_results_from_pipeline() we were resetting _rowcount
if negative. This is superfluous as this code is reached when coming
from _executemany_gen_pipeline() in which we already do
'self._rowcount = 0' early on.
Denis Laxalde [Sun, 8 Jan 2023 14:35:27 +0000 (15:35 +0100)]
ci: fix a typo in libpq install script
Denis Laxalde [Sun, 8 Jan 2023 14:34:24 +0000 (15:34 +0100)]
ci: remove sudo from libpq install script
Denis Laxalde [Sun, 8 Jan 2023 09:51:22 +0000 (10:51 +0100)]
ci: simplify retrieval of PGDG repository key
We don't need to gpg dearmor as APT can read .asc file format fine.
Denis Laxalde [Sun, 8 Jan 2023 09:39:35 +0000 (10:39 +0100)]
ci: factor out common logic in libpq install script
Denis Laxalde [Sat, 7 Jan 2023 18:50:37 +0000 (19:50 +0100)]
ci: install the "oldest" libpq from pgdg repository
Daniele Varrazzo [Sat, 7 Jan 2023 12:54:49 +0000 (12:54 +0000)]
doc: fix typo unless -> unlike
Daniele Varrazzo [Fri, 6 Jan 2023 17:29:59 +0000 (17:29 +0000)]
refactor: drop internal use of Union[] type definition in TypeInfo.fetch()
Daniele Varrazzo [Fri, 6 Jan 2023 17:21:19 +0000 (17:21 +0000)]
fix: use more uniformly the to_regtype function
Make the knowledge of the function to use independent from the knowledge
of the types implemented by a certain database.
Daniele Varrazzo [Fri, 6 Jan 2023 13:35:38 +0000 (13:35 +0000)]
test(crdb): fix flakey test
We often find a "delete" record more than once in the changefeed, before
deleting it. Tolerate one.
Daniele Varrazzo [Fri, 6 Jan 2023 14:43:54 +0000 (14:43 +0000)]
Merge pull request #474 from CaselIT/to_regclass
Use to_regtype instead of ::regtype in type info queries
Federico Caselli [Thu, 5 Jan 2023 21:41:29 +0000 (22:41 +0100)]
Use to_regtype instead of ::regtype in type info queries on supported dbs
Daniele Varrazzo [Tue, 3 Jan 2023 19:40:38 +0000 (19:40 +0000)]
fix: report the MultirangeInfo object exposed by psycopg.types.multirange
Daniele Varrazzo [Mon, 2 Jan 2023 21:48:03 +0000 (21:48 +0000)]
Merge branch 'build-backend'
Daniele Varrazzo [Mon, 2 Jan 2023 01:59:26 +0000 (01:59 +0000)]
ci: add in-tree build backend to avoid installing Cython if not needed
Only install Cython when there are pyx files to build. If there aren't,
it means that the c files are already available and Cython is not
required.
Close #471.
Daniele Varrazzo [Mon, 2 Jan 2023 03:26:32 +0000 (03:26 +0000)]
ci: use the 'build' python package as build frontend
Daniele Varrazzo [Mon, 2 Jan 2023 03:01:41 +0000 (03:01 +0000)]
ci: fix building source packages
Something was broken recently and installing from the package root
doesn't work anymore.
Daniele Varrazzo [Mon, 2 Jan 2023 02:10:34 +0000 (02:10 +0000)]
Merge branch 'test-lower-bound-depsendencies'
Daniele Varrazzo [Sat, 31 Dec 2022 03:07:39 +0000 (03:07 +0000)]
ci: include a single test with the oldest dependencies versions
Daniele Varrazzo [Sat, 31 Dec 2022 03:07:17 +0000 (03:07 +0000)]
chore: update the lower bound dependencies in the constraint file
Lower minimum dependency on pytest-randomly to version 3.5, as
version 3.6 requires a newer importlib-metadata.
Daniele Varrazzo [Mon, 26 Dec 2022 03:47:42 +0000 (03:47 +0000)]
fix: raise known errors before checking for signals in waiting
Daniele Varrazzo [Mon, 26 Dec 2022 06:09:34 +0000 (06:09 +0000)]
test: add psycopg2 in green mode to benchmark script
This is a more accurate comparison between psycopg2 and 3.
Daniele Varrazzo [Fri, 23 Dec 2022 04:24:51 +0000 (04:24 +0000)]
test: add --concurrency option to benchmark script
Investigate the poor parallelism mentioned in #448.
Daniele Varrazzo [Wed, 28 Dec 2022 03:26:43 +0000 (03:26 +0000)]
style: uniform variable name between sync and async cursor
Daniele Varrazzo [Fri, 23 Dec 2022 18:04:14 +0000 (18:04 +0000)]
fix: raise OperationalError instead of MemoryError on several operations
Failure is related to the operation executed, not to memory not
available to store the result.
Daniele Varrazzo [Thu, 29 Dec 2022 00:48:22 +0000 (00:48 +0000)]
chore: add Documentation, Changes links to metadata
Daniele Varrazzo [Thu, 29 Dec 2022 00:31:30 +0000 (00:31 +0000)]
feat(bump-version): add --actions option
Daniele Varrazzo [Thu, 29 Dec 2022 00:53:19 +0000 (00:53 +0000)]
Merge branch 'refactor-version-from-metadata'
Daniele Varrazzo [Thu, 29 Dec 2022 00:26:33 +0000 (00:26 +0000)]
chore(bump-version): find versions to maintain in setup.cfg files
Daniele Varrazzo [Wed, 28 Dec 2022 23:45:23 +0000 (23:45 +0000)]
docs: move comments about version scheme and coordination to setup.ini
stengah [Thu, 22 Dec 2022 14:44:05 +0000 (20:29 +0545)]
refactor(pool): get package version from metadata
stengah [Thu, 22 Dec 2022 05:13:46 +0000 (10:58 +0545)]
refactor(c): get package version from metadata
stengah [Wed, 21 Dec 2022 16:00:33 +0000 (21:45 +0545)]
refactor: get package version from metadata
Daniele Varrazzo [Thu, 22 Dec 2022 22:19:07 +0000 (22:19 +0000)]
chore(c): lean win32
Daniele Varrazzo [Thu, 22 Dec 2022 21:28:12 +0000 (21:28 +0000)]
chore(c): fix build warnings on win32
Daniele Varrazzo [Thu, 22 Dec 2022 16:25:40 +0000 (16:25 +0000)]
ci: uniform and clean up test workflow
Daniele Varrazzo [Thu, 22 Dec 2022 22:48:44 +0000 (22:48 +0000)]
test(crdb): skip inet tests on v22.2.1
Work around https://github.com/cockroachdb/cockroach/issues/94192
Daniele Varrazzo [Thu, 22 Dec 2022 19:07:10 +0000 (19:07 +0000)]
chore(pool): add pyproject.toml
Daniele Varrazzo [Tue, 20 Dec 2022 20:19:23 +0000 (20:19 +0000)]
ci: configure the database to run two-phase-commit tests
We can't use the Github Actions PostgreSQL service because it doesn't
seem possible to configure the server for stored transactions:
- the service yaml definition doesn't take args to pass to run
- we can't overwrite the entry point with a script of ours because the
service starts before actions/checkout
- the postgres image doesn't allow to pass extra parameters to the
server via an env var
Daniele Varrazzo [Thu, 22 Dec 2022 03:04:10 +0000 (03:04 +0000)]
test: fix int mixin enum in test
Daniele Varrazzo [Wed, 21 Dec 2022 23:00:32 +0000 (23:00 +0000)]
perf: micro-optimize AdaptersMap.get_dumper
Minimal amount of opcodes in case of fast-path (there is an adapter
precisely for the class queried).
Daniele Varrazzo [Tue, 20 Dec 2022 15:25:14 +0000 (15:25 +0000)]
ci: separate source and binary package workflows
Daniele Varrazzo [Tue, 20 Dec 2022 15:56:34 +0000 (15:56 +0000)]
chore: bump psycopg_pool package version to 3.1.6.dev1
Daniele Varrazzo [Tue, 20 Dec 2022 15:56:23 +0000 (15:56 +0000)]
chore: bump psycopg package version to 3.1.8.dev1
Daniele Varrazzo [Tue, 20 Dec 2022 15:14:42 +0000 (15:14 +0000)]
test: mark another couple of tests flakey to avoid delaying releases
Daniele Varrazzo [Tue, 20 Dec 2022 03:46:30 +0000 (03:46 +0000)]
chore: bump psycopg_pool package version to 3.1.5
Daniele Varrazzo [Tue, 20 Dec 2022 03:46:27 +0000 (03:46 +0000)]
chore: bump psycopg package version to 3.1.7
Daniele Varrazzo [Tue, 20 Dec 2022 03:43:46 +0000 (03:43 +0000)]
feat(bump_version): create release tags too
Daniele Varrazzo [Tue, 20 Dec 2022 03:13:17 +0000 (03:13 +0000)]
feat(bump_version): update history file too
Daniele Varrazzo [Mon, 19 Dec 2022 23:58:18 +0000 (23:58 +0000)]
Merge branch 'fix-464'
Daniele Varrazzo [Mon, 19 Dec 2022 22:46:42 +0000 (22:46 +0000)]
fix: consider cursor description results in row factories
Fix #464
Daniele Varrazzo [Mon, 19 Dec 2022 13:21:02 +0000 (13:21 +0000)]
Merge branch 'detox'
Daniele Varrazzo [Sun, 18 Dec 2022 19:14:16 +0000 (19:14 +0000)]
test: drop --allow-fail and --no-collect-ok options
They were needed to deal with problem caused by tox. Not needed anymore.
Daniele Varrazzo [Sun, 18 Dec 2022 15:23:26 +0000 (15:23 +0000)]
ci: enable subprocess-based tests in ci
Daniele Varrazzo [Sun, 18 Dec 2022 02:54:08 +0000 (02:54 +0000)]
test: skip test on windows, C implementation, in ci
No idea why ctypes doesn't work, and I really don't care.
Daniele Varrazzo [Thu, 8 Dec 2022 14:44:36 +0000 (14:44 +0000)]
ci: drop tox from tests