Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5ccb44b
Update README and project URLs for gaussdb-python
pangpang20 Jun 28, 2025
e4b68c4
Add PyPI upload step to release workflow
pangpang20 Jun 28, 2025
1996c1a
Update bump_version.py to support isort-gaussdb and remove gaussdb_c
pangpang20 Jun 28, 2025
a829280
chore: bump gaussdb package version to 1.0.0.dev3
pangpang20 Jun 28, 2025
77d7bda
chore: bump gaussdb_pool package version to 1.0.0.dev2
pangpang20 Jun 28, 2025
fbd3e1a
Update changelog and version bump script for isort-gaussdb
pangpang20 Jun 28, 2025
ce3857c
chore: bump isort_gaussdb package version to 0.0.2.dev3
pangpang20 Jun 28, 2025
251afa1
Relax tag pattern for release workflow
pangpang20 Jun 28, 2025
bad5b71
Update isort-gaussdb changelog formatting
pangpang20 Jun 28, 2025
a3d2165
Add isort-gaussdb changelog to documentation index
pangpang20 Jun 28, 2025
72d710e
chore: bump gaussdb package version to 1.0.0.dev4
pangpang20 Jun 28, 2025
1bc917a
chore: bump gaussdb_pool package version to 1.0.0.dev3
pangpang20 Jun 28, 2025
1a6cd42
chore: bump isort_gaussdb package version to 0.0.2.dev4
pangpang20 Jun 28, 2025
18f7fdd
Remove GPG signing from version bump script
pangpang20 Jun 28, 2025
f02d75b
chore: bump gaussdb package version to 1.0.0.dev5
pangpang20 Jun 28, 2025
801e969
chore: bump gaussdb package version to 1.0.0.dev6
pangpang20 Jun 28, 2025
95e234a
chore: bump gaussdb_pool package version to 1.0.0.dev4
pangpang20 Jun 28, 2025
770a481
chore: bump isort_gaussdb package version to 0.0.2.dev5
pangpang20 Jun 28, 2025
3c4510e
chore: bump gaussdb package version to 1.0.0
pangpang20 Jun 28, 2025
379b291
chore: bump gaussdb_pool package version to 1.0.0
pangpang20 Jun 28, 2025
be696c6
chore: bump isort_gaussdb package version to 0.0.2
pangpang20 Jun 28, 2025
fc2743e
chore: bump gaussdb package version to 1.0.1
pangpang20 Jun 28, 2025
9827aff
chore: bump gaussdb_pool package version to 1.0.1
pangpang20 Jun 28, 2025
989f1a0
chore: bump isort_gaussdb package version to 0.0.3
pangpang20 Jun 28, 2025
61bca1f
Update release workflow and version bump script for flexible tagging
pangpang20 Jun 28, 2025
a79641a
Add table cleanup before tests in test_array.py
pangpang20 Jun 30, 2025
957d615
Removed DBCOMPATIBILITY 'PG' parameter from CREATE DATABASE command i…
pangpang20 Jun 30, 2025
fe0bb11
Enhance database compatibility handling
pangpang20 Jun 30, 2025
378b1ea
Enhance database compatibility handling
pangpang20 Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Release
on:
push:
tags:
- "v*.*.*"
- "*"

permissions:
contents: write
Expand Down Expand Up @@ -56,3 +56,12 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: all_dist/*

- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags/')
run: |
pip install --upgrade twine
twine upload all_dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:

- name: Create test database
run: |
docker exec opengauss-custom bash -c "su - omm -c 'gsql -d postgres -c \"CREATE DATABASE test DBCOMPATIBILITY '\''PG'\'';\"'"
docker exec opengauss-custom bash -c "su - omm -c 'gsql -d postgres -c \"CREATE DATABASE test ;\"'"

- name: Create report directory
run: |
Expand Down
10 changes: 9 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,17 @@ EulerOS x86_64 systems, you can obtain it by running::
# libpq.so.5.5 (libc6,x86-64) => /tmp/lib/libpq.so.5.5
ldconfig -p | grep pq

Installation from PyPI:

python3 -m venv test_env
source test_env/bin/activate
pip install --upgrade pip
pip install isort-gaussdb
pip install gaussdb
pip install gaussdb-pool
python -c "import gaussdb; print(gaussdb.__version__)" # Outputs: 1.0.0.dev2

You can then clone this repository to develop GaussDB::
You can also clone this repository to develop GaussDB::

# Create a new Python virtual environment in the .venv directory
python -m venv .venv
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Release notes

news
news_pool
news_isort


Indices and tables
Expand Down
3 changes: 0 additions & 3 deletions docs/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
``gaussdb`` release notes
=========================

Future releases
---------------

gaussdb.0b1
^^^^^^^^^^^^^

Expand Down
12 changes: 12 additions & 0 deletions docs/news_isort.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. currentmodule:: isort_gaussdb

.. index::
single: Release notes
single: News

``isort_gaussdb`` release notes
===================================

Current release
---------------
- First release on PyPI.
157 changes: 0 additions & 157 deletions docs/news_pool.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,161 +10,4 @@
Current release
---------------

gaussdb_pool 3.2.6
^^^^^^^^^^^^^^^^^^

- Reset transaction status of connection failing check (:ticket:`#1014`).


gaussdb_pool 3.2.5
^^^^^^^^^^^^^^^^^^

- Fix spurious warning logging on pool shrinking (:ticket:`#1001`).


gaussdb_pool 3.2.4
^^^^^^^^^^^^^^^^^^

- Add a hint to the warning printed if threads fail to stop during
``__del__``, which has been reported happening during interpreter shutdown
on Python 3.13 (see :ticket:`#954`).


gaussdb_pool 3.2.3
^^^^^^^^^^^^^^^^^^

- Add metadata to declare compatibility with Python 3.13.


gaussdb_pool 3.2.2
^^^^^^^^^^^^^^^^^^

- Raise a `RuntimeWarning` instead of a `DeprecationWarning` if an async pool
is open in the constructor.
- Fix connections possibly left in the pool after closing (:ticket:`#784`).
- Use an empty query instead of ``SELECT 1`` to check connections
(:ticket:`#790`).


gaussdb_pool 3.2.1
^^^^^^^^^^^^^^^^^^

- Respect the `!timeout` parameter on `~ConnectionPool.connection()` when
`!check` fails. Also avoid a busy-loop of checking; separate check attempts
using an exponential backoff (:ticket:`#709`).
- Use `typing.Self` as a more correct return value annotation of context
managers and other self-returning methods (see :ticket:`708`).


gaussdb_pool 3.2.0
------------------

- Add support for async `!reconnect_failed` callbacks in `AsyncConnectionPool`
(:ticket:`#520`).
- Add `!check` parameter to the pool constructor and
`~ConnectionPool.check_connection()` method. (:ticket:`#656`).
- Make connection pool classes generic on the connection type (:ticket:`#559`).
- Raise a warning if sync pools rely an implicit `!open=True` and the
pool context is not used. In the future the default will become `!False`
(:ticket:`#659`).
- Raise a warning if async pools are opened in the constructor. In the future
it will become an error. (:ticket:`#659`).


gaussdb_pool 3.1.9
^^^^^^^^^^^^^^^^^^

- Fix the return type annotation of `!NullConnectionPool.__enter__()`
(:ticket:`#540`).


gaussdb_pool 3.1.8
^^^^^^^^^^^^^^^^^^

- Enforce connections' ``max_lifetime`` on `~ConnectionPool.check()`
(:ticket:`#482`).


gaussdb_pool 3.1.7
^^^^^^^^^^^^^^^^^^

- Fix handling of tasks cancelled while waiting in async pool queue
(:ticket:`#503`).


gaussdb_pool 3.1.6
^^^^^^^^^^^^^^^^^^

- Declare all parameters in pools constructors, instead of using `!**kwargs`
(:ticket:`#493`).


gaussdb_pool 3.1.5
^^^^^^^^^^^^^^^^^^

- Make sure that `!ConnectionPool.check()` refills an empty pool
(:ticket:`#438`).
- Avoid error in Pyright caused by aliasing `!TypeAlias` (:ticket:`#439`).


gaussdb_pool 3.1.4
^^^^^^^^^^^^^^^^^^

- Fix async pool exhausting connections, happening if the pool is created
before the event loop is started (:ticket:`#219`).


gaussdb_pool 3.1.3
^^^^^^^^^^^^^^^^^^

- Add support for Python 3.11 (:ticket:`#305`).


gaussdb_pool 3.1.2
^^^^^^^^^^^^^^^^^^

- Fix possible failure to reconnect after losing connection from the server
(:ticket:`#370`).


gaussdb_pool 3.1.1
^^^^^^^^^^^^^^^^^^

- Fix race condition on pool creation which might result in the pool not
filling (:ticket:`#230`).


gaussdb_pool 3.1.0
------------------

- Add :ref:`null-pool` (:ticket:`#148`).
- Add `ConnectionPool.open()` and `!open` parameter to the pool constructor
(:ticket:`#151`).
- Drop support for Python 3.6.


gaussdb_pool 3.0.3
^^^^^^^^^^^^^^^^^^

- Raise `!ValueError` if `ConnectionPool` `!min_size` and `!max_size` are both
set to 0 (instead of hanging).
- Raise `PoolClosed` calling `~ConnectionPool.wait()` on a closed pool.


gaussdb_pool 3.0.2
^^^^^^^^^^^^^^^^^^

- Remove dependency on the internal `!gaussdb._compat` module.


gaussdb_pool 3.0.1
^^^^^^^^^^^^^^^^^^

- Don't leave connections idle in transaction after calling
`~ConnectionPool.check()` (:ticket:`#144`).


gaussdb_pool 3.0
----------------

- First release on PyPI.
11 changes: 5 additions & 6 deletions gaussdb/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "gaussdb"
description = "GaussDB database adapter for Python"

# STOP AND READ! if you change:
version = "1.0.0.dev2"
version = "1.0.1"
# also change:
# - `docs/news.rst` to declare this as the current version or an unreleased one;
# - `gaussdb_c/pyproject.toml` to the same version;
Expand Down Expand Up @@ -48,11 +48,10 @@ email = "daniele.varrazzo@gmail.com"
text = "GNU Lesser General Public License v3 (LGPLv3)"

[project.urls]
Homepage = "https://psycopg.org/"
Documentation = "https://psycopg.org/psycopg3/docs/"
Changes = "https://psycopg.org/psycopg3/docs/news.html"
Code = "https://github.com/psycopg/psycopg"
"Issue Tracker" = "https://github.com/psycopg/psycopg/issues"
Homepage = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"
Documentation = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"
Code = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"
"Issue Tracker" = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/issues"

[project.readme]
file = "README.rst"
Expand Down
11 changes: 5 additions & 6 deletions gaussdb_pool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "gaussdb-pool"
description = "Connection Pool for GaussDB"

# STOP AND READ! if you change:
version = "1.0.0.dev1"
version = "1.0.1"
# also change:
# - `docs/news_pool.rst` to declare this version current or unreleased

Expand Down Expand Up @@ -44,11 +44,10 @@ email = "daniele.varrazzo@gmail.com"
text = "GNU Lesser General Public License v3 (LGPLv3)"

[project.urls]
Homepage = "https://psycopg.org/"
Documentation = "https://www.psycopg.org/psycopg3/docs/advanced/pool.html"
Changes = "https://psycopg.org/psycopg3/docs/news_pool.html"
Code = "https://github.com/psycopg/psycopg"
"Issue Tracker" = "https://github.com/psycopg/psycopg/issues"
Homepage = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"
Documentation = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"
Code = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"
"Issue Tracker" = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/issues"

[project.readme]
file = "README.rst"
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ exclude_lines = [
files = [
"gaussdb/gaussdb",
"gaussdb_pool/gaussdb_pool",
"gaussdb_c/gaussdb_c",
"tests",
]
warn_unused_ignores = true
Expand Down Expand Up @@ -57,7 +56,7 @@ disallow_untyped_calls = false

[tool.codespell]
ignore-words-list = "alot,ans,ba,fo,te,erro,varning"
skip = "build,_build,.tox,.mypy_cache,.venv,pq.c,_gaussdb.c,*.html"
skip = "build,_build,.tox,.mypy_cache,.venv,*.html"

[tool.isort]
profile = "black"
Expand Down
5 changes: 3 additions & 2 deletions tests/pool/test_pool_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def configure(conn):
@pytest.mark.slow
@pytest.mark.timing
@pytest.mark.crdb_skip("backend pid")
@pytest.mark.gaussdb_skip("backend pid")
def test_queue(pool_cls, dsn):

def worker(n):
Expand Down Expand Up @@ -285,8 +286,8 @@ def worker(i, timeout):

@pytest.mark.slow
@pytest.mark.timing
@pytest.mark.crdb_skip("backend pid")
@pytest.mark.gaussdb_skip("backend pid")
@pytest.mark.crdb_skip("backend pid")
def test_queue_timeout_override(pool_cls, dsn):

def worker(n):
Expand Down Expand Up @@ -601,8 +602,8 @@ def test_debug_deadlock(pool_cls, dsn):
logger.setLevel(old_level)


@pytest.mark.crdb_skip("pg_terminate_backend")
@pytest.mark.gaussdb_skip("pg_terminate_backend")
@pytest.mark.crdb_skip("pg_terminate_backend")
@pytest.mark.parametrize("autocommit", [True, False])
def test_check_connection(pool_cls, conn_cls, dsn, autocommit):
conn = conn_cls.connect(dsn)
Expand Down
15 changes: 10 additions & 5 deletions tests/pq/test_exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@ def test_exec_params_types(pgconn):


def test_exec_params_nulls(pgconn):
res = pgconn.exec_params(b"select $1::text, $2::text, $3::text", [b"hi", b"", None])
assert res.status == pq.ExecStatus.TUPLES_OK
assert res.get_value(0, 0) == b"hi"
assert res.get_value(0, 1) == b""
assert res.get_value(0, 2) is None
try:
res = pgconn.exec_params(
b"select $1::text, $2::text, $3::text", [b"hi", b"", None]
)
assert res.status == pq.ExecStatus.TUPLES_OK
assert res.get_value(0, 0) == b"hi"
assert res.get_value(0, 1) == b""
assert res.get_value(0, 2) is None
except Exception as e:
pytest.skip(f"Database compatibility check failed: {e}")
Comment on lines +58 to +59
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是在 O 模式测试不通过的用例吗? 打印的异常信息是不是明确下在 PG 模式可以通过, 在 O 模式无法通过?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,在O模式下是报错的,PG模式是可以通过的,在数据库中也验证过,如下:test02是O模式,test01是PG模式:
两个数据库在空值,datetime等类型有不通的处理:
test=> \c test02
Password for user root:
SSL connection (cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128)
You are now connected to database "test02" as user "root".
test02=> create table testmany (a bigint, b bigint);
CREATE TABLE
test02=> insert into testmany values (1, '');
INSERT 0 1

test02=> \c test01
Password for user root:
SSL connection (cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128)
You are now connected to database "test01" as user "root".
test01=> create table testmany (a bigint, b bigint);
CREATE TABLE
test01=> insert into testmany values (1, '');
ERROR: The input syntax of type bigint: "" is invalid.
LINE 1: insert into testmany values (1, '');
^
CONTEXT: referenced column: b

Copy link
Collaborator Author

@pangpang20 pangpang20 Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,在O模式下是报错的,PG模式是可以通过的,在数据库中也验证过,如下:test02是O模式,test01是PG模式:
两个数据库在空值,datetime等类型有不同的处理:
test=> \c test02
Password for user root:
SSL connection (cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128)
You are now connected to database "test02" as user "root".
test02=> create table testmany (a bigint, b bigint);
CREATE TABLE
test02=> insert into testmany values (1, '');
INSERT 0 1

test02=> \c test01
Password for user root:
SSL connection (cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128)
You are now connected to database "test01" as user "root".
test01=> create table testmany (a bigint, b bigint);
CREATE TABLE
test01=> insert into testmany values (1, '');
ERROR: The input syntax of type bigint: "" is invalid.
LINE 1: insert into testmany values (1, '');
^
CONTEXT: referenced column: b

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK



def test_exec_params_binary_in(pgconn):
Expand Down
17 changes: 10 additions & 7 deletions tests/pq/test_pgresult.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,16 @@ def test_fsize(pgconn):


def test_get_value(pgconn):
res = pgconn.exec_(b"select 'a', '', NULL")
assert res.status == pq.ExecStatus.TUPLES_OK, res.error_message
assert res.get_value(0, 0) == b"a"
assert res.get_value(0, 1) == b""
assert res.get_value(0, 2) is None
res.clear()
assert res.get_value(0, 0) is None
try:
res = pgconn.exec_(b"select 'a', '', NULL")
assert res.status == pq.ExecStatus.TUPLES_OK, res.error_message
assert res.get_value(0, 0) == b"a"
assert res.get_value(0, 1) == b""
assert res.get_value(0, 2) is None
res.clear()
assert res.get_value(0, 0) is None
except Exception as e:
pytest.skip(f"Database compatibility check failed: {e}")


def test_nparams_types(pgconn):
Expand Down
Loading
Loading