]> git.ipfire.org Git - thirdparty/psycopg.git/log
thirdparty/psycopg.git
21 months agodocs(pool): document check callback, drop previous recipes and rants 658/head
Daniele Varrazzo [Sat, 7 Oct 2023 02:16:43 +0000 (04:16 +0200)] 
docs(pool): document check callback, drop previous recipes and rants

21 months agotest(pool): add tests to verify check on getconn's behaviour
Daniele Varrazzo [Fri, 6 Oct 2023 16:31:52 +0000 (18:31 +0200)] 
test(pool): add tests to verify check on getconn's behaviour

21 months agofix(pool): clean up logging in getconn check
Daniele Varrazzo [Fri, 6 Oct 2023 16:30:18 +0000 (18:30 +0200)] 
fix(pool): clean up logging in getconn check

If a check callback is set, assume that failed checks on getconn are
just part of normal operative life: don't consider them warnings.

21 months agofeat(pool): add `check` connection parameter
Daniele Varrazzo [Fri, 6 Oct 2023 13:15:04 +0000 (15:15 +0200)] 
feat(pool): add `check` connection parameter

Allow to specify a callback to call on getconn and discard the
connection if not in working state.

21 months agofeat(pool): add `check_connection()` method
Daniele Varrazzo [Fri, 6 Oct 2023 13:13:39 +0000 (15:13 +0200)] 
feat(pool): add `check_connection()` method

The method is public, will be documented as available to use as check
parameter, but also used internally by the `check()` method.

21 months agorefactor(pool): introduce a loop in getconn to allow connection check
Daniele Varrazzo [Fri, 6 Oct 2023 11:00:41 +0000 (13:00 +0200)] 
refactor(pool): introduce a loop in getconn to allow connection check

21 months agoMerge branch 'pool-warn-implicit-open'
Daniele Varrazzo [Sat, 14 Oct 2023 07:40:00 +0000 (09:40 +0200)] 
Merge branch 'pool-warn-implicit-open'

21 months agodocs(pool): warn about future behaviour changes of open on init 659/head
Daniele Varrazzo [Fri, 13 Oct 2023 23:51:11 +0000 (01:51 +0200)] 
docs(pool): warn about future behaviour changes of open on init

21 months agofeat(pool): raise a warning if async pools are open in the constructor
Daniele Varrazzo [Sun, 8 Oct 2023 18:43:47 +0000 (20:43 +0200)] 
feat(pool): raise a warning if async pools are open in the constructor

21 months agofeat(pool) raise a warning if the pool is expected to be opened implicitly
Daniele Varrazzo [Sat, 7 Oct 2023 22:01:57 +0000 (00:01 +0200)] 
feat(pool) raise a warning if the pool is expected to be opened implicitly

21 months agorefactor: define conn_encoding on pgconn_encoding
Daniele Varrazzo [Wed, 11 Oct 2023 23:06:47 +0000 (01:06 +0200)] 
refactor: define conn_encoding on pgconn_encoding

Also more consistent use of the two functions throughout the codebase.

21 months agochore: move codespell configuration to toml file
Daniele Varrazzo [Fri, 13 Oct 2023 23:52:05 +0000 (01:52 +0200)] 
chore: move codespell configuration to toml file

Configuration tweaked to avoid files commonly found in dev environments.

21 months agostyle(pool): more explicit error message for pool open with no loop
Daniele Varrazzo [Sun, 8 Oct 2023 17:31:07 +0000 (19:31 +0200)] 
style(pool): more explicit error message for pool open with no loop

21 months agoMerge branch 'async-to-sync'
Daniele Varrazzo [Fri, 13 Oct 2023 22:52:36 +0000 (00:52 +0200)] 
Merge branch 'async-to-sync'

21 months agoMerge pull request #660 from dlax/async-to-sync 657/head
Daniele Varrazzo [Fri, 13 Oct 2023 22:49:51 +0000 (23:49 +0100)] 
Merge pull request #660 from dlax/async-to-sync

improvements to tools/async_to_sync.py

21 months agorefactor: allow to use podman container engine in async_to_sync.py 660/head
Denis Laxalde [Fri, 13 Oct 2023 07:40:09 +0000 (09:40 +0200)] 
refactor: allow to use podman container engine in async_to_sync.py

21 months agofeat(tools): warn about the Python version used in async-to-sync
Daniele Varrazzo [Fri, 13 Oct 2023 14:04:12 +0000 (16:04 +0200)] 
feat(tools): warn about the Python version used in async-to-sync

Notify the user that they may get spurious results.

21 months agofix(tools): remove mention of dropped shell script in async_to_sync.py
Denis Laxalde [Fri, 13 Oct 2023 07:36:28 +0000 (09:36 +0200)] 
fix(tools): remove mention of dropped shell script in async_to_sync.py

21 months agorefactor: use text mode for subprocess in async_to_sync.py
Denis Laxalde [Fri, 13 Oct 2023 06:51:54 +0000 (08:51 +0200)] 
refactor: use text mode for subprocess in async_to_sync.py

21 months agorefactor: replace 'git ls-files' + 'grep' by a single 'git grep'
Denis Laxalde [Fri, 13 Oct 2023 06:54:01 +0000 (08:54 +0200)] 
refactor: replace 'git ls-files' + 'grep' by a single 'git grep'

21 months agochore: use Python 3.11 to conver async to sync
Daniele Varrazzo [Fri, 13 Oct 2023 01:35:26 +0000 (03:35 +0200)] 
chore: use Python 3.11 to conver async to sync

21 months agochore: add option to run async_to_sync in a docker image
Daniele Varrazzo [Fri, 13 Oct 2023 01:22:04 +0000 (03:22 +0200)] 
chore: add option to run async_to_sync in a docker image

This allows to specify which Python version to use for the conversion
(even when it's not installed on the machine).

21 months agorefactor: drop 'convert_async_to_sync.sh' script
Daniele Varrazzo [Fri, 13 Oct 2023 00:19:03 +0000 (02:19 +0200)] 
refactor: drop 'convert_async_to_sync.sh' script

Do all in 'async_to_sync.py:' added --all and --check options.

21 months agotest: drop unneeded raise on pytest.skip()
Daniele Varrazzo [Wed, 11 Oct 2023 11:30:46 +0000 (13:30 +0200)] 
test: drop unneeded raise on pytest.skip()

21 months agorefactor(test): uniform the way sync/async-only tests are skipped
Daniele Varrazzo [Sun, 8 Oct 2023 13:55:31 +0000 (15:55 +0200)] 
refactor(test): uniform the way sync/async-only tests are skipped

Add @skip_sync, @skip_async markers to mark the functions to skip.

21 months agotest: add check to verify the completeness of convert_async_to_sync
Daniele Varrazzo [Sun, 8 Oct 2023 10:33:47 +0000 (12:33 +0200)] 
test: add check to verify the completeness of convert_async_to_sync

Verify that all the files commented as having been automatically
converted are actually included in the script converting them.

21 months agostyle: more care in the docstring mentioning sync/async versions of the code
Daniele Varrazzo [Sun, 8 Oct 2023 09:55:58 +0000 (11:55 +0200)] 
style: more care in the docstring mentioning sync/async versions of the code

21 months agorefactor(pool): define scheduler task as dataclass
Daniele Varrazzo [Sun, 8 Oct 2023 09:45:28 +0000 (11:45 +0200)] 
refactor(pool): define scheduler task as dataclass

21 months agorefactor(async_to_sync): create new object without listing all the attributes
Daniele Varrazzo [Sun, 8 Oct 2023 09:02:23 +0000 (11:02 +0200)] 
refactor(async_to_sync): create new object without listing all the attributes

21 months agostyle(pool): use `pass` instead of `return` for empty methods
Daniele Varrazzo [Sun, 8 Oct 2023 08:32:29 +0000 (10:32 +0200)] 
style(pool): use `pass` instead of `return` for empty methods

21 months agodocs: fix typos/grammar
Daniele Varrazzo [Sun, 8 Oct 2023 08:30:26 +0000 (09:30 +0100)] 
docs: fix typos/grammar

Co-authored-by: Daniel Fortunov <asqui@users.noreply.github.com>
21 months agorefactor(copy): generate sync code from async
Daniele Varrazzo [Fri, 6 Oct 2023 10:58:49 +0000 (12:58 +0200)] 
refactor(copy): generate sync code from async

21 months agorefactor(test): add acompat module
Daniele Varrazzo [Thu, 5 Oct 2023 23:58:54 +0000 (01:58 +0200)] 
refactor(test): add acompat module

21 months agofeat(tools): allow to specify the files to convert async to sync
Daniele Varrazzo [Fri, 6 Oct 2023 13:02:50 +0000 (15:02 +0200)] 
feat(tools): allow to specify the files to convert async to sync

21 months agofix: fix type annotation problems on Python 3.8, 3.9
Daniele Varrazzo [Thu, 5 Oct 2023 03:10:00 +0000 (05:10 +0200)] 
fix: fix type annotation problems on Python 3.8, 3.9

21 months agorefactor(pool): generate null pool module from async counterpart
Daniele Varrazzo [Thu, 5 Oct 2023 02:06:34 +0000 (04:06 +0200)] 
refactor(pool): generate null pool module from async counterpart

21 months agorefactor(pool): move null pool base to its own module
Daniele Varrazzo [Thu, 5 Oct 2023 01:58:57 +0000 (03:58 +0200)] 
refactor(pool): move null pool base to its own module

And some more light refactoring.

21 months agorefactor(pool): generate pool sync module from async counterpart
Daniele Varrazzo [Thu, 5 Oct 2023 01:40:28 +0000 (03:40 +0200)] 
refactor(pool): generate pool sync module from async counterpart

21 months agorefactor(pool): add Worker/AWorker type aliases
Daniele Varrazzo [Thu, 5 Oct 2023 00:57:08 +0000 (02:57 +0200)] 
refactor(pool): add Worker/AWorker type aliases

With these we don't have direct dependencies on the asyncio and
threading modules in the pool classes.

21 months agorefactor(pool): give sync attribute the same life cycle of the async one
Daniele Varrazzo [Thu, 5 Oct 2023 00:43:50 +0000 (02:43 +0200)] 
refactor(pool): give sync attribute the same life cycle of the async one

Create possibly async objects only after we are sure that a loop is
running.

21 months agorefactor(pool): use non-string typing annotations
Daniele Varrazzo [Thu, 5 Oct 2023 00:22:20 +0000 (02:22 +0200)] 
refactor(pool): use non-string typing annotations

21 months agorefactor(pool): add functions to get current thread/task name
Daniele Varrazzo [Thu, 5 Oct 2023 00:21:15 +0000 (02:21 +0200)] 
refactor(pool): add functions to get current thread/task name

The latter is only possible as we dropped support for Python 3.7.

21 months agorefactor(pool): add Queue/AQueue compatibility objects
Daniele Varrazzo [Wed, 4 Oct 2023 22:21:58 +0000 (00:21 +0200)] 
refactor(pool): add Queue/AQueue compatibility objects

21 months agorefactor(pool): add spawn/gather async compat functions
Daniele Varrazzo [Wed, 4 Oct 2023 22:01:24 +0000 (00:01 +0200)] 
refactor(pool): add spawn/gather async compat functions

21 months agorefactor(pool): add psycopg_pool._acompat to ease async/sync differences
Daniele Varrazzo [Wed, 4 Oct 2023 20:44:48 +0000 (22:44 +0200)] 
refactor(pool): add psycopg_pool._acompat to ease async/sync differences

21 months agorefactor(pool): add psycopg_pool.abc module
Daniele Varrazzo [Wed, 4 Oct 2023 20:02:58 +0000 (22:02 +0200)] 
refactor(pool): add psycopg_pool.abc module

21 months agochore: make ast-comments an ordinary dev dependency
Daniele Varrazzo [Wed, 4 Oct 2023 18:38:44 +0000 (20:38 +0200)] 
chore: make ast-comments an ordinary dev dependency

21 months agoci: pin ast-comments to work around bug, document other bug as submitted
Daniele Varrazzo [Mon, 2 Oct 2023 10:08:09 +0000 (12:08 +0200)] 
ci: pin ast-comments to work around bug, document other bug as submitted

21 months agorefactor(pool): light refactor to align async and sync pool
Daniele Varrazzo [Sun, 1 Oct 2023 01:59:37 +0000 (03:59 +0200)] 
refactor(pool): light refactor to align async and sync pool

21 months agorefactor(tests): generate null pool tests from async counterpart
Daniele Varrazzo [Tue, 12 Sep 2023 05:08:21 +0000 (07:08 +0200)] 
refactor(tests): generate null pool tests from async counterpart

21 months agorefactor(tests): generate most pool tests using parametric fixture
Daniele Varrazzo [Tue, 12 Sep 2023 04:48:10 +0000 (06:48 +0200)] 
refactor(tests): generate most pool tests using parametric fixture

21 months agorefactor(tests): rename cursor tests to keep them together
Daniele Varrazzo [Mon, 11 Sep 2023 22:19:22 +0000 (23:19 +0100)] 
refactor(tests): rename cursor tests to keep them together

Also rename test_default_cursor to just test_cursor as we renamed the
common tests in the previous commit.

21 months agorefactor(tests): rename test_cursor to test_cursor_common
Daniele Varrazzo [Mon, 11 Sep 2023 22:15:11 +0000 (23:15 +0100)] 
refactor(tests): rename test_cursor to test_cursor_common

21 months agorefactor(tests): generate test_pool from async counterpart
Daniele Varrazzo [Mon, 11 Sep 2023 21:57:44 +0000 (22:57 +0100)] 
refactor(tests): generate test_pool from async counterpart

21 months agorefactor(tests): generate test_sched from async counterpart
Daniele Varrazzo [Mon, 11 Sep 2023 17:50:44 +0000 (18:50 +0100)] 
refactor(tests): generate test_sched from async counterpart

21 months agorefactor(pool): generate Scheduler from AsyncScheduler
Daniele Varrazzo [Mon, 11 Sep 2023 16:10:17 +0000 (17:10 +0100)] 
refactor(pool): generate Scheduler from AsyncScheduler

21 months agorefactor: generate connection.py from connection_async
Daniele Varrazzo [Sat, 2 Sep 2023 21:22:09 +0000 (22:22 +0100)] 
refactor: generate connection.py from connection_async

21 months agorefactor(async_to_sync): finally solved the Tuple mystery
Daniele Varrazzo [Sat, 2 Sep 2023 21:18:30 +0000 (22:18 +0100)] 
refactor(async_to_sync): finally solved the Tuple mystery

The problem came from names shadowing in the ast_comment module. To be
reported upstream.

21 months agorefactor(connection): harmless manipulation to minimize async conversion diff
Daniele Varrazzo [Sat, 2 Sep 2023 21:10:05 +0000 (22:10 +0100)] 
refactor(connection): harmless manipulation to minimize async conversion diff

21 months agodocs: copy connection docstrings to async class
Daniele Varrazzo [Sat, 2 Sep 2023 21:05:28 +0000 (22:05 +0100)] 
docs: copy connection docstrings to async class

21 months agoperf(waiting): drop unneeded wait_for in wait_conn_async if no timeout is set
Daniele Varrazzo [Sat, 2 Sep 2023 20:47:20 +0000 (21:47 +0100)] 
perf(waiting): drop unneeded wait_for in wait_conn_async if no timeout is set

21 months agofeat(connection): add set_autocommit() and similar methods
Daniele Varrazzo [Sat, 2 Sep 2023 20:41:32 +0000 (21:41 +0100)] 
feat(connection): add set_autocommit() and similar methods

21 months agorefactor: move BaseConnetion in its own module
Daniele Varrazzo [Sat, 2 Sep 2023 16:31:18 +0000 (17:31 +0100)] 
refactor: move BaseConnetion in its own module

This commit is brought you by: flight delayed 6 hours for technical failure.

21 months agorefactor: generate cursor.py from cursor_async
Daniele Varrazzo [Mon, 21 Aug 2023 17:10:25 +0000 (18:10 +0100)] 
refactor: generate cursor.py from cursor_async

21 months agodocs: add docstrings from sync cursor to async
Daniele Varrazzo [Sat, 19 Aug 2023 17:19:48 +0000 (18:19 +0100)] 
docs: add docstrings from sync cursor to async

21 months agorefactor: move the BaseCursor class to its own module
Daniele Varrazzo [Sat, 19 Aug 2023 17:18:59 +0000 (18:18 +0100)] 
refactor: move the BaseCursor class to its own module

21 months agoci: check for inconsistencies between sync and async code
Daniele Varrazzo [Tue, 15 Aug 2023 22:12:25 +0000 (23:12 +0100)] 
ci: check for inconsistencies between sync and async code

21 months agofeat: add --check mode to sync-to-async script
Daniele Varrazzo [Tue, 15 Aug 2023 22:08:48 +0000 (23:08 +0100)] 
feat: add --check mode to sync-to-async script

It will be useful to set up a pipeline to check for inconsistencies.

21 months agorefactor(tests): generate tpc, transaction sync tests from async
Daniele Varrazzo [Tue, 15 Aug 2023 18:49:12 +0000 (19:49 +0100)] 
refactor(tests): generate tpc, transaction sync tests from async

21 months agorefactor(tests): make transaction sync/async tests more uniform
Daniele Varrazzo [Tue, 15 Aug 2023 18:29:34 +0000 (19:29 +0100)] 
refactor(tests): make transaction sync/async tests more uniform

21 months agorefactor(tests): generate sync prepared statements tests from async side
Daniele Varrazzo [Tue, 15 Aug 2023 18:18:12 +0000 (19:18 +0100)] 
refactor(tests): generate sync prepared statements tests from async side

21 months agorefactor(tests): auto-generate sync version of cursor subclasses
Daniele Varrazzo [Tue, 15 Aug 2023 18:05:58 +0000 (19:05 +0100)] 
refactor(tests): auto-generate sync version of cursor subclasses

21 months agorefactor(tests): auto-generate test_copy from async counterpart
Daniele Varrazzo [Thu, 10 Aug 2023 01:02:52 +0000 (02:02 +0100)] 
refactor(tests): auto-generate test_copy from async counterpart

21 months agorefactor(tests): make test_copy and async counterpart more similar
Daniele Varrazzo [Thu, 10 Aug 2023 00:33:41 +0000 (01:33 +0100)] 
refactor(tests): make test_copy and async counterpart more similar

21 months agorefactor(tests): auto-generate test_client_cursor from async counterpart
Daniele Varrazzo [Thu, 10 Aug 2023 00:16:31 +0000 (01:16 +0100)] 
refactor(tests): auto-generate test_client_cursor from async counterpart

21 months agorefactor(tests): generate test_pipeline from async counterpart
Daniele Varrazzo [Thu, 10 Aug 2023 00:07:08 +0000 (01:07 +0100)] 
refactor(tests): generate test_pipeline from async counterpart

21 months agofix(async-to-sync): fold long strings as multiline
Daniele Varrazzo [Tue, 8 Aug 2023 22:18:23 +0000 (23:18 +0100)] 
fix(async-to-sync): fold long strings as multiline

21 months agorefactor(tests): auto-generate test_connection from async
Daniele Varrazzo [Mon, 7 Aug 2023 23:16:19 +0000 (00:16 +0100)] 
refactor(tests): auto-generate test_connection from async

21 months agorefactor(tests): make sync and async connection tests more similar
Daniele Varrazzo [Mon, 7 Aug 2023 22:02:04 +0000 (23:02 +0100)] 
refactor(tests): make sync and async connection tests more similar

21 months agotest: fix use of aclosing in Python < 3.10
Daniele Varrazzo [Mon, 7 Aug 2023 16:09:26 +0000 (17:09 +0100)] 
test: fix use of aclosing in Python < 3.10

21 months agorefactor(tests): auto-generate the test_cursor module from async_test_cursor
Daniele Varrazzo [Mon, 7 Aug 2023 09:11:24 +0000 (10:11 +0100)] 
refactor(tests): auto-generate the test_cursor module from async_test_cursor

Use a script to translate an async module to sync. The module is to be
extended to cover the entire test suite and then possibly the rest of
the code.

21 months agorefactor(tests): tweak test_cursor to make it more similar to the async version
Daniele Varrazzo [Mon, 7 Aug 2023 08:58:05 +0000 (09:58 +0100)] 
refactor(tests): tweak test_cursor to make it more similar to the async version

21 months agodocs: update requirements specifiers link
Daniele Varrazzo [Wed, 11 Oct 2023 21:44:43 +0000 (23:44 +0200)] 
docs: update requirements specifiers link

21 months agodocs: adjust list of supported systems.
Daniele Varrazzo [Tue, 10 Oct 2023 21:45:35 +0000 (23:45 +0200)] 
docs: adjust list of supported systems.

- Mention Solaris/BSD as not officially supported.
- Drop non-GitHub macOS reference: we are now distributing Apple M1
  packages too, so that's a lie.

21 months agodocs: making fun of psycopg3
Daniele Varrazzo [Tue, 10 Oct 2023 21:45:13 +0000 (23:45 +0200)] 
docs: making fun of psycopg3

For small values of fun.

21 months agodocs: link together readme files on PyPI and add reference to psycopg2
Daniele Varrazzo [Tue, 10 Oct 2023 21:21:57 +0000 (23:21 +0200)] 
docs: link together readme files on PyPI and add reference to psycopg2

See https://github.com/psycopg/psycopg2/issues/1632

21 months agodocs: clean up details and errors in type annotations, more pages
Daniele Varrazzo [Tue, 10 Oct 2023 14:11:52 +0000 (16:11 +0200)] 
docs: clean up details and errors in type annotations, more pages

21 months agochore: drop 'set -x' (commented and not) from scripts
Daniele Varrazzo [Sun, 8 Oct 2023 09:31:29 +0000 (11:31 +0200)] 
chore: drop 'set -x' (commented and not) from scripts

21 months agodocs(pool): simpler, less detailed, more opinionated pool docs page
Daniele Varrazzo [Sat, 7 Oct 2023 01:49:46 +0000 (03:49 +0200)] 
docs(pool): simpler, less detailed, more opinionated pool docs page

Show a very basic usage example, then give a more detailed connection
life cycle illustration. Push lower and keep shorter the alternative
creation methods.

21 months agotest: mark array leak test slow
Daniele Varrazzo [Fri, 6 Oct 2023 19:37:17 +0000 (21:37 +0200)] 
test: mark array leak test slow

It takes 300ms, but it's still a blip when other tests run.

Add notes in the tests readme about repeating finding slow tests.

21 months agorefactor(pool): don't use a no-op function as reconnect callback
Daniele Varrazzo [Fri, 6 Oct 2023 15:04:42 +0000 (17:04 +0200)] 
refactor(pool): don't use a no-op function as reconnect callback

Just check for None.

21 months agostyle(pool): don't report too many decimals in timeout error message
Daniele Varrazzo [Fri, 6 Oct 2023 12:38:44 +0000 (14:38 +0200)] 
style(pool): don't report too many decimals in timeout error message

21 months agofix(pool): trade off usage timing precision for robustness
Daniele Varrazzo [Fri, 6 Oct 2023 12:36:43 +0000 (14:36 +0200)] 
fix(pool): trade off usage timing precision for robustness

It is unlikely that the statements we shuffled around will fail;
however, let's do the right thing and make sure that, if they do, the
getconn/putconn pair remains matched.

21 months agodocs(pool): fix changelog entry
Daniele Varrazzo [Fri, 6 Oct 2023 09:43:23 +0000 (11:43 +0200)] 
docs(pool): fix changelog entry

Attributing Generic pool feature entry to 3.2.0, not to 3.1.9.

21 months agoMerge branch 'fix-652'
Daniele Varrazzo [Tue, 3 Oct 2023 16:31:06 +0000 (18:31 +0200)] 
Merge branch 'fix-652'

21 months agotest: verify that time objects with failing utcoffset() are handled correctly
Daniele Varrazzo [Tue, 3 Oct 2023 16:09:11 +0000 (18:09 +0200)] 
test: verify that time objects with failing utcoffset() are handled correctly

21 months agofix: raise DataError dumping a time with ambiguous timezone
Daniele Varrazzo [Tue, 3 Oct 2023 16:08:19 +0000 (18:08 +0200)] 
fix: raise DataError dumping a time with ambiguous timezone

Close #652

21 months agochore: drop Python 3.7 support
Daniele Varrazzo [Sun, 1 Oct 2023 02:25:05 +0000 (04:25 +0200)] 
chore: drop Python 3.7 support

Also drop from the test grid PostgreSQL 10, now unsupported.

21 months agoci: add PostgreSQL 16 to the test grid
Daniele Varrazzo [Tue, 3 Oct 2023 11:26:16 +0000 (13:26 +0200)] 
ci: add PostgreSQL 16 to the test grid

21 months agotest: test Python 3.12 on all platform with final image
Daniele Varrazzo [Tue, 3 Oct 2023 11:21:46 +0000 (13:21 +0200)] 
test: test Python 3.12 on all platform with final image