aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pg8000
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-05-13 08:41:32 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-05-13 08:49:12 +0300
commit729cf217631f33c3297a77b89df46671992350ac (patch)
treedb808d27d756c10fe26ab8aba46e1b52d7fb0476 /contrib/python/pg8000
parentb2d826f65dc1cddb9e2ebca3b0048bb0e8052340 (diff)
downloadydb-729cf217631f33c3297a77b89df46671992350ac.tar.gz
Intermediate changes
Diffstat (limited to 'contrib/python/pg8000')
-rw-r--r--contrib/python/pg8000/.dist-info/METADATA32
-rw-r--r--contrib/python/pg8000/README.md27
-rw-r--r--contrib/python/pg8000/pg8000/core.py8
-rw-r--r--contrib/python/pg8000/ya.make2
4 files changed, 61 insertions, 8 deletions
diff --git a/contrib/python/pg8000/.dist-info/METADATA b/contrib/python/pg8000/.dist-info/METADATA
index ba1c9b0727..f89f5ac7aa 100644
--- a/contrib/python/pg8000/.dist-info/METADATA
+++ b/contrib/python/pg8000/.dist-info/METADATA
@@ -1,8 +1,9 @@
Metadata-Version: 2.3
Name: pg8000
-Version: 1.31.1
+Version: 1.31.2
Summary: PostgreSQL interface library
Project-URL: Homepage, https://github.com/tlocke/pg8000
+Author: The Contributors
License: BSD 3-Clause License
License-File: LICENSE
Keywords: dbapi,postgresql
@@ -23,7 +24,7 @@ Classifier: Topic :: Database :: Front-Ends
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: python-dateutil>=2.8.2
-Requires-Dist: scramp>=1.4.4
+Requires-Dist: scramp>=1.4.5
Description-Content-Type: text/markdown
# pg8000
@@ -400,7 +401,26 @@ pg8000.exceptions.DatabaseError: ...
```
-instead you can write it using the [unnest
+the most straightforward way to get around this problem is to rewrie the query using the [`ANY`](
+https://www.postgresql.org/docs/current/functions-comparisons.html#FUNCTIONS-COMPARISONS-ANY-SOME)
+function:
+
+```python
+>>> import pg8000.native
+>>>
+>>> con = pg8000.native.Connection("postgres", password="cpsnow")
+>>>
+>>> con.run("SELECT 'silo 1' WHERE 'a' = ANY(:v)", v=['a', 'b'])
+[['silo 1']]
+>>> con.close()
+
+```
+
+However, using the array variant of `ANY` [may cause a performance problem](
+https://stackoverflow.com/questions/34627026/in-vs-any-operator-in-postgresql/34627688#34627688)
+and so you can use the [subquery variant of `IN`](
+https://www.postgresql.org/docs/current/functions-subquery.html#FUNCTIONS-SUBQUERY-IN)
+with the [unnest
](https://www.postgresql.org/docs/current/functions-array.html) function:
```python
@@ -2068,6 +2088,12 @@ twine upload dist/*
## Release Notes
+### Version 1.31.2, 2024-04-28
+
+- Fix bug where `parameter_statuses` fails for non-ascii encoding.
+- Add support for Python 3.12
+
+
### Version 1.31.1, 2024-04-01
- Move to src style layout, and also for packaging use Hatch rather than setuptools. This means that if the source distribution has a directory added to it (as is needed for packaging for OS distributions) the package can still be built.
diff --git a/contrib/python/pg8000/README.md b/contrib/python/pg8000/README.md
index 306734221a..05c7fb8de8 100644
--- a/contrib/python/pg8000/README.md
+++ b/contrib/python/pg8000/README.md
@@ -372,7 +372,26 @@ pg8000.exceptions.DatabaseError: ...
```
-instead you can write it using the [unnest
+the most straightforward way to get around this problem is to rewrie the query using the [`ANY`](
+https://www.postgresql.org/docs/current/functions-comparisons.html#FUNCTIONS-COMPARISONS-ANY-SOME)
+function:
+
+```python
+>>> import pg8000.native
+>>>
+>>> con = pg8000.native.Connection("postgres", password="cpsnow")
+>>>
+>>> con.run("SELECT 'silo 1' WHERE 'a' = ANY(:v)", v=['a', 'b'])
+[['silo 1']]
+>>> con.close()
+
+```
+
+However, using the array variant of `ANY` [may cause a performance problem](
+https://stackoverflow.com/questions/34627026/in-vs-any-operator-in-postgresql/34627688#34627688)
+and so you can use the [subquery variant of `IN`](
+https://www.postgresql.org/docs/current/functions-subquery.html#FUNCTIONS-SUBQUERY-IN)
+with the [unnest
](https://www.postgresql.org/docs/current/functions-array.html) function:
```python
@@ -2040,6 +2059,12 @@ twine upload dist/*
## Release Notes
+### Version 1.31.2, 2024-04-28
+
+- Fix bug where `parameter_statuses` fails for non-ascii encoding.
+- Add support for Python 3.12
+
+
### Version 1.31.1, 2024-04-01
- Move to src style layout, and also for packaging use Hatch rather than setuptools. This means that if the source distribution has a directory added to it (as is needed for packaging for OS distributions) the package can still be built.
diff --git a/contrib/python/pg8000/pg8000/core.py b/contrib/python/pg8000/pg8000/core.py
index ce187baa54..230ad90901 100644
--- a/contrib/python/pg8000/pg8000/core.py
+++ b/contrib/python/pg8000/pg8000/core.py
@@ -16,7 +16,7 @@ from pg8000.converters import (
make_params,
string_in,
)
-from pg8000.exceptions import DatabaseError, Error, InterfaceError
+from pg8000.exceptions import DatabaseError, InterfaceError
ver = version("pg8000")
@@ -385,7 +385,7 @@ class CoreConnection:
if context.error is not None:
raise context.error
- except Error as e:
+ except BaseException as e:
self.close()
raise e
@@ -850,7 +850,9 @@ class CoreConnection:
def handle_PARAMETER_STATUS(self, data, context):
pos = data.find(NULL_BYTE)
- key, value = data[:pos].decode("ascii"), data[pos + 1 : -1].decode("ascii")
+ key, value = data[:pos].decode("ascii"), data[pos + 1 : -1].decode(
+ self._client_encoding
+ )
self.parameter_statuses[key] = value
if key == "client_encoding":
encoding = value.lower()
diff --git a/contrib/python/pg8000/ya.make b/contrib/python/pg8000/ya.make
index 33a1150199..9dffc62147 100644
--- a/contrib/python/pg8000/ya.make
+++ b/contrib/python/pg8000/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(1.31.1)
+VERSION(1.31.2)
LICENSE(BSD-3-Clause)