Skip to content

Numpy types support#332

Merged
dvarrazzo merged 26 commits intopsycopg:masterfrom
vertefra:numpy-types-support
Aug 5, 2023
Merged

Numpy types support#332
dvarrazzo merged 26 commits intopsycopg:masterfrom
vertefra:numpy-types-support

Conversation

@vertefra
Copy link
Copy Markdown
Contributor

dumpers for numpy int, bool and uint

Copy link
Copy Markdown
Member

@dvarrazzo dvarrazzo left a comment

Choose a reason for hiding this comment

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

I have noticed that you can add numpy support to mypy, but I'm not sure it's worth, as we should add numpy as a dev dependency. If we decide we don't, mypy errors must be silenced.

Comment thread psycopg/psycopg/_queries.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread tests/types/test_numpy.py
Comment thread tests/types/test_numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread psycopg/psycopg/types/numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
Comment thread tests/types/test_numpy.py Outdated
@dvarrazzo dvarrazzo added this to the 3.2 milestone Sep 28, 2022
@dvarrazzo dvarrazzo force-pushed the numpy-types-support branch 2 times, most recently from 1b7a1ac to 11bae43 Compare December 16, 2022 20:38
@dvarrazzo
Copy link
Copy Markdown
Member

Test pass clean finally 🙂

Copy link
Copy Markdown
Contributor

@dlax dlax left a comment

Choose a reason for hiding this comment

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

Changes look good to me; just a few nits.

That's a really great addition!

Comment thread psycopg/psycopg/postgres.py Outdated
Comment on lines +125 to +128
# Make sure to register dumpers to the standard types last, in order to
# pick them by default when looking up by oid.
numpy.register_default_adapters(context)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Strange comment: numpy's types are not "standard types", no?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this comment needs rewording then 🙂

What I meant is that there was this failure. This was caused by the fact that both Python's Decimal and numpy's uint64 have a dumper registered with the Postgres' numeric oid. But the former covers the entire numeric domain, the latter just the integers. If the latter is registered later then, if we look up for dumpers by oids, we will pick it even in order to dump a Decimal, we will cast it to int, dropping the decimal part.

The situation happens whenever there is more than one dumper registered which can produce the same oid. So far, IIRC, it only happened for the dbapi-compliant Binary wrapper, whose dumper is chosen in preference of the basic binary dumper, because it can cover both types of objects.

@@ -43,10 +52,6 @@ def dump(self, obj: Any) -> Buffer:

return str(obj).encode()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return str(obj).encode()
return super().dump(obj)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TBH I really don't like the need of an isinstance per int dump.

Now that we have Enum dumpers, I would like to try if it's possible to associate a pure int dumper to ints (one that just assumes that str(obj) returns the number representation) and associate a dumper converting to int only to enums.

@dvarrazzo
Copy link
Copy Markdown
Member

dvarrazzo commented Dec 17, 2022

State of this brach to complete, methinks:

  • add test to verify that lists of these types are handled correctly (although probably this is already covered by the random tests).
  • maybe: verify that numpy arrays are handled correctly by array dumpers. This would be inefficient, but would start covering the array domain. See Add support for numpy array #336 to deal with them properly. numpy arrays are an entirely different object, so it's not the case to add it here.
  • test with C dumpers too. At the moment this is cumbersome because of the way the CI workflow is organised, especially because tox gets in the way. Easy to add after finishing Remove tox from CI  #462

@dvarrazzo dvarrazzo force-pushed the numpy-types-support branch 2 times, most recently from 001d179 to c7f69b7 Compare December 19, 2022 15:43
@dvarrazzo dvarrazzo marked this pull request as ready for review December 19, 2022 21:53
@dvarrazzo dvarrazzo force-pushed the numpy-types-support branch 5 times, most recently from 4d171e3 to e125d5d Compare January 13, 2023 02:45
@Volatus
Copy link
Copy Markdown

Volatus commented Feb 21, 2023

When could this possibly be finalized? @dvarrazzo

@dvarrazzo dvarrazzo force-pushed the numpy-types-support branch 2 times, most recently from 230b61f to 29d9e1a Compare August 3, 2023 15:34
If numpy dumpers are registered after numeric ones, then NPNumericBinaryDumper
is used instead of NumericBinaryDumper when looking up by oid. This
breaks dumping values with a decimal part.
    >>> numpy.float16("-0.00018227100372314453")
    -0.0001823

    >>> -0.0001823 == pytest.approx(-0.00018227100372314453, rel=1e-5)
    False

    >>> -0.0001823 == pytest.approx(-0.00018227100372314453, rel=1e-3)
    True
Also drop context optionality in adapters registration.
It is less useful than in binary mode, but it was being pretty much
ignored.
These types are now marked immutable. Use a module variable instead.
@dvarrazzo dvarrazzo force-pushed the numpy-types-support branch from 29d9e1a to 92b30b0 Compare August 5, 2023 14:21
@dvarrazzo dvarrazzo merged commit 43e9ff5 into psycopg:master Aug 5, 2023
@dvarrazzo
Copy link
Copy Markdown
Member

Finally merged to master! Thank you very much!

github-merge-queue bot referenced this pull request in microsoft/semantic-kernel Oct 4, 2023
Bumps [psycopg](https://github.com/psycopg/psycopg) from 3.1.10 to
3.1.12.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psycopg/psycopg/blob/master/docs/news.rst">psycopg's
changelog</a>.</em></p>
<blockquote>
<p>.. currentmodule:: psycopg</p>
<p>.. index::
single: Release notes
single: News</p>
<h1><code>psycopg</code> release notes</h1>
<h2>Future releases</h2>
<p>Psycopg 3.2 (unreleased)
^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Add support for integer, floating point, boolean <code>NumPy scalar
types</code>__

(:ticket:<code>[#332](https://github.com/psycopg/psycopg/issues/332)</code>).</li>
<li>Add :ref:<code>raw-query-cursors</code> to execute queries using
placeholders in
PostgreSQL format (<code>$1</code>, <code>$2</code>...)
(🎫<code>[#560](https://github.com/psycopg/psycopg/issues/560)</code>).</li>
<li>Add support for libpq functions to close prepared statements and
portals
introduced in libpq v17
(:ticket:<code>[#603](https://github.com/psycopg/psycopg/issues/603)</code>).</li>
<li>Disable receiving more than one result on the same cursor in
pipeline mode,
to iterate through <code>~Cursor.nextset()</code>. The behaviour was
different than
in non-pipeline mode and not totally reliable
(:ticket:<code>[#604](https://github.com/psycopg/psycopg/issues/604)</code>).
The <code>Cursor</code> now only preserves the results set of the last
<code>~Cursor.execute()</code>, consistently with non-pipeline
mode.</li>
</ul>
<p>.. __: <a
href="https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types">https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types</a></p>
<h2>Current release</h2>
<p>Psycopg 3.1.12
^^^^^^^^^^^^^^</p>
<ul>
<li>Fix possible hanging if a connection is closed while querying
(:ticket:<code>[#608](https://github.com/psycopg/psycopg/issues/608)</code>).</li>
<li>Fix memory leak when <code>~register_*()</code> functions are called
repeatedly

(:ticket:<code>[#647](https://github.com/psycopg/psycopg/issues/647)</code>).</li>
</ul>
<p>Psycopg 3.1.11
^^^^^^^^^^^^^^</p>
<ul>
<li>Avoid caching the parsing results of large queries to avoid
excessive memory
usage
(:ticket:<code>[#628](https://github.com/psycopg/psycopg/issues/628)</code>).</li>
<li>Fix integer overflow in C/binary extension with OID &gt; 2^31
(:ticket:<code>[#630](https://github.com/psycopg/psycopg/issues/630)</code>).</li>
<li>Fix loading of intervals with days and months or years
(:ticket:<code>[#643](https://github.com/psycopg/psycopg/issues/643)</code>).</li>
<li>Work around excessive CPU usage on Windows (reported in
:ticket:<code>[#645](https://github.com/psycopg/psycopg/issues/645)</code>).</li>
<li>Fix building on Solaris and derivatives
(:ticket:<code>[#632](https://github.com/psycopg/psycopg/issues/632)</code>).</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/psycopg/psycopg/commit/5498bb85c62cbe71da16731e9f25e8727a098c80"><code>5498bb8</code></a>
chore: bump psycopg package version to 3.1.12</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b4b8ceb32da7f182ba0e3e0e81d692ce604b15cb"><code>b4b8ceb</code></a>
Merge branch 'fix-608' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/ae43e63400dc7366dde1e26d689cff69238c7d2c"><code>ae43e63</code></a>
fix: use poll() instead of epoll() for waiting</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/8b564e8f2539e6accaa853ec80636ab0d2d53de1"><code>8b564e8</code></a>
fix: don't hang forever if async connection is closed while
querying</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b3e0be9869257cfa9602608caee4ebe96148f63f"><code>b3e0be9</code></a>
fix: don't raise spurious errors on cancel if the connection is
closed</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/125f93c852cf9a0c4158fe45f162b3b420568a8e"><code>125f93c</code></a>
ci(scaleway_m1): add list command and jq pretty output</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/87dc783af3e744fb6dc411794f9efb627b9a7d1e"><code>87dc783</code></a>
chore(crdb): test 23.1 in CI</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/dbddfc5d3f567cb291b6f98868a97de9ec40d153"><code>dbddfc5</code></a>
Merge branch 'fix-647' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/4137dedad1e2e9078562bbb1ad5fff1b7ef640ed"><code>4137ded</code></a>
fix: cache all dynamically generated adapter types</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/d7eea4989766ea92b0d7d51559ff11779ff3b872"><code>d7eea49</code></a>
fix: cache dynamic adapters created in register_array()</li>
<li>Additional commits viewable in <a
href="https://github.com/psycopg/psycopg/compare/3.1.10...3.1.12">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg&package-manager=pip&previous-version=3.1.10&new-version=3.1.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
github-merge-queue bot referenced this pull request in microsoft/semantic-kernel Oct 4, 2023
Bumps [psycopg](https://github.com/psycopg/psycopg) from 3.1.10 to
3.1.12.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psycopg/psycopg/blob/master/docs/news.rst">psycopg's
changelog</a>.</em></p>
<blockquote>
<p>.. currentmodule:: psycopg</p>
<p>.. index::
single: Release notes
single: News</p>
<h1><code>psycopg</code> release notes</h1>
<h2>Future releases</h2>
<p>Psycopg 3.2 (unreleased)
^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Add support for integer, floating point, boolean <code>NumPy scalar
types</code>__

(:ticket:<code>[#332](https://github.com/psycopg/psycopg/issues/332)</code>).</li>
<li>Add :ref:<code>raw-query-cursors</code> to execute queries using
placeholders in
PostgreSQL format (<code>$1</code>, <code>$2</code>...)
(🎫<code>[#560](https://github.com/psycopg/psycopg/issues/560)</code>).</li>
<li>Add support for libpq functions to close prepared statements and
portals
introduced in libpq v17
(:ticket:<code>[#603](https://github.com/psycopg/psycopg/issues/603)</code>).</li>
<li>Disable receiving more than one result on the same cursor in
pipeline mode,
to iterate through <code>~Cursor.nextset()</code>. The behaviour was
different than
in non-pipeline mode and not totally reliable
(:ticket:<code>[#604](https://github.com/psycopg/psycopg/issues/604)</code>).
The <code>Cursor</code> now only preserves the results set of the last
<code>~Cursor.execute()</code>, consistently with non-pipeline
mode.</li>
</ul>
<p>.. __: <a
href="https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types">https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types</a></p>
<h2>Current release</h2>
<p>Psycopg 3.1.12
^^^^^^^^^^^^^^</p>
<ul>
<li>Fix possible hanging if a connection is closed while querying
(:ticket:<code>[#608](https://github.com/psycopg/psycopg/issues/608)</code>).</li>
<li>Fix memory leak when <code>~register_*()</code> functions are called
repeatedly

(:ticket:<code>[#647](https://github.com/psycopg/psycopg/issues/647)</code>).</li>
</ul>
<p>Psycopg 3.1.11
^^^^^^^^^^^^^^</p>
<ul>
<li>Avoid caching the parsing results of large queries to avoid
excessive memory
usage
(:ticket:<code>[#628](https://github.com/psycopg/psycopg/issues/628)</code>).</li>
<li>Fix integer overflow in C/binary extension with OID &gt; 2^31
(:ticket:<code>[#630](https://github.com/psycopg/psycopg/issues/630)</code>).</li>
<li>Fix loading of intervals with days and months or years
(:ticket:<code>[#643](https://github.com/psycopg/psycopg/issues/643)</code>).</li>
<li>Work around excessive CPU usage on Windows (reported in
:ticket:<code>[#645](https://github.com/psycopg/psycopg/issues/645)</code>).</li>
<li>Fix building on Solaris and derivatives
(:ticket:<code>[#632](https://github.com/psycopg/psycopg/issues/632)</code>).</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/psycopg/psycopg/commit/5498bb85c62cbe71da16731e9f25e8727a098c80"><code>5498bb8</code></a>
chore: bump psycopg package version to 3.1.12</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b4b8ceb32da7f182ba0e3e0e81d692ce604b15cb"><code>b4b8ceb</code></a>
Merge branch 'fix-608' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/ae43e63400dc7366dde1e26d689cff69238c7d2c"><code>ae43e63</code></a>
fix: use poll() instead of epoll() for waiting</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/8b564e8f2539e6accaa853ec80636ab0d2d53de1"><code>8b564e8</code></a>
fix: don't hang forever if async connection is closed while
querying</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b3e0be9869257cfa9602608caee4ebe96148f63f"><code>b3e0be9</code></a>
fix: don't raise spurious errors on cancel if the connection is
closed</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/125f93c852cf9a0c4158fe45f162b3b420568a8e"><code>125f93c</code></a>
ci(scaleway_m1): add list command and jq pretty output</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/87dc783af3e744fb6dc411794f9efb627b9a7d1e"><code>87dc783</code></a>
chore(crdb): test 23.1 in CI</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/dbddfc5d3f567cb291b6f98868a97de9ec40d153"><code>dbddfc5</code></a>
Merge branch 'fix-647' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/4137dedad1e2e9078562bbb1ad5fff1b7ef640ed"><code>4137ded</code></a>
fix: cache all dynamically generated adapter types</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/d7eea4989766ea92b0d7d51559ff11779ff3b872"><code>d7eea49</code></a>
fix: cache dynamic adapters created in register_array()</li>
<li>Additional commits viewable in <a
href="https://github.com/psycopg/psycopg/compare/3.1.10...3.1.12">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg&package-manager=pip&previous-version=3.1.10&new-version=3.1.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
SOE-YoungS referenced this pull request in SOE-YoungS/semantic-kernel Nov 1, 2023
Bumps [psycopg](https://github.com/psycopg/psycopg) from 3.1.10 to
3.1.12.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psycopg/psycopg/blob/master/docs/news.rst">psycopg's
changelog</a>.</em></p>
<blockquote>
<p>.. currentmodule:: psycopg</p>
<p>.. index::
single: Release notes
single: News</p>
<h1><code>psycopg</code> release notes</h1>
<h2>Future releases</h2>
<p>Psycopg 3.2 (unreleased)
^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Add support for integer, floating point, boolean <code>NumPy scalar
types</code>__

(:ticket:<code>[microsoft#332](https://github.com/psycopg/psycopg/issues/332)</code>).</li>
<li>Add :ref:<code>raw-query-cursors</code> to execute queries using
placeholders in
PostgreSQL format (<code>$1</code>, <code>$2</code>...)
(🎫<code>[microsoft#560](https://github.com/psycopg/psycopg/issues/560)</code>).</li>
<li>Add support for libpq functions to close prepared statements and
portals
introduced in libpq v17
(:ticket:<code>[microsoft#603](https://github.com/psycopg/psycopg/issues/603)</code>).</li>
<li>Disable receiving more than one result on the same cursor in
pipeline mode,
to iterate through <code>~Cursor.nextset()</code>. The behaviour was
different than
in non-pipeline mode and not totally reliable
(:ticket:<code>[microsoft#604](https://github.com/psycopg/psycopg/issues/604)</code>).
The <code>Cursor</code> now only preserves the results set of the last
<code>~Cursor.execute()</code>, consistently with non-pipeline
mode.</li>
</ul>
<p>.. __: <a
href="https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types">https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types</a></p>
<h2>Current release</h2>
<p>Psycopg 3.1.12
^^^^^^^^^^^^^^</p>
<ul>
<li>Fix possible hanging if a connection is closed while querying
(:ticket:<code>[microsoft#608](https://github.com/psycopg/psycopg/issues/608)</code>).</li>
<li>Fix memory leak when <code>~register_*()</code> functions are called
repeatedly

(:ticket:<code>[microsoft#647](https://github.com/psycopg/psycopg/issues/647)</code>).</li>
</ul>
<p>Psycopg 3.1.11
^^^^^^^^^^^^^^</p>
<ul>
<li>Avoid caching the parsing results of large queries to avoid
excessive memory
usage
(:ticket:<code>[microsoft#628](https://github.com/psycopg/psycopg/issues/628)</code>).</li>
<li>Fix integer overflow in C/binary extension with OID &gt; 2^31
(:ticket:<code>[microsoft#630](https://github.com/psycopg/psycopg/issues/630)</code>).</li>
<li>Fix loading of intervals with days and months or years
(:ticket:<code>[microsoft#643](https://github.com/psycopg/psycopg/issues/643)</code>).</li>
<li>Work around excessive CPU usage on Windows (reported in
:ticket:<code>[microsoft#645](https://github.com/psycopg/psycopg/issues/645)</code>).</li>
<li>Fix building on Solaris and derivatives
(:ticket:<code>[microsoft#632](https://github.com/psycopg/psycopg/issues/632)</code>).</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/psycopg/psycopg/commit/5498bb85c62cbe71da16731e9f25e8727a098c80"><code>5498bb8</code></a>
chore: bump psycopg package version to 3.1.12</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b4b8ceb32da7f182ba0e3e0e81d692ce604b15cb"><code>b4b8ceb</code></a>
Merge branch 'fix-608' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/ae43e63400dc7366dde1e26d689cff69238c7d2c"><code>ae43e63</code></a>
fix: use poll() instead of epoll() for waiting</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/8b564e8f2539e6accaa853ec80636ab0d2d53de1"><code>8b564e8</code></a>
fix: don't hang forever if async connection is closed while
querying</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b3e0be9869257cfa9602608caee4ebe96148f63f"><code>b3e0be9</code></a>
fix: don't raise spurious errors on cancel if the connection is
closed</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/125f93c852cf9a0c4158fe45f162b3b420568a8e"><code>125f93c</code></a>
ci(scaleway_m1): add list command and jq pretty output</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/87dc783af3e744fb6dc411794f9efb627b9a7d1e"><code>87dc783</code></a>
chore(crdb): test 23.1 in CI</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/dbddfc5d3f567cb291b6f98868a97de9ec40d153"><code>dbddfc5</code></a>
Merge branch 'fix-647' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/4137dedad1e2e9078562bbb1ad5fff1b7ef640ed"><code>4137ded</code></a>
fix: cache all dynamically generated adapter types</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/d7eea4989766ea92b0d7d51559ff11779ff3b872"><code>d7eea49</code></a>
fix: cache dynamic adapters created in register_array()</li>
<li>Additional commits viewable in <a
href="https://github.com/psycopg/psycopg/compare/3.1.10...3.1.12">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg&package-manager=pip&previous-version=3.1.10&new-version=3.1.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
github-merge-queue bot referenced this pull request in microsoft/semantic-kernel Feb 20, 2024
Bumps [psycopg](https://github.com/psycopg/psycopg) from 3.1.15 to
3.1.18.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/psycopg/psycopg/blob/master/docs/news.rst">psycopg's
changelog</a>.</em></p>
<blockquote>
<p>.. currentmodule:: psycopg</p>
<p>.. index::
single: Release notes
single: News</p>
<h1><code>psycopg</code> release notes</h1>
<h2>Future releases</h2>
<p>Psycopg 3.2 (unreleased)
^^^^^^^^^^^^^^^^^^^^^^^^</p>
<ul>
<li>Add support for integer, floating point, boolean <code>NumPy scalar
types</code>__

(:ticket:<code>[#332](https://github.com/psycopg/psycopg/issues/332)</code>).</li>
<li>Add <code>!timeout</code> and <code>!stop_after</code> parameters to
<code>Connection.notifies()</code>
(:ticket:<code>340</code>).</li>
<li>Add :ref:<code>raw-query-cursors</code> to execute queries using
placeholders in
PostgreSQL format (<code>$1</code>, <code>$2</code>...)
(:ticket:<code>[#560](https://github.com/psycopg/psycopg/issues/560)</code>).</li>
<li>Add <code>~rows.scalar_row</code> to return scalar values from a
query
(:ticket:<code>[#723](https://github.com/psycopg/psycopg/issues/723)</code>).</li>
<li>Add <code>~Connection.set_autocommit()</code> on sync connections,
and similar
transaction control methods available on the async connections.</li>
<li>Add support for libpq functions to close prepared statements and
portals
introduced in libpq v17
(:ticket:<code>[#603](https://github.com/psycopg/psycopg/issues/603)</code>).</li>
<li>The <code>!context</code> parameter of <code>sql</code> objects
<code>~sql.Composable.as_string()</code> and
<code>~sql.Composable.as_bytes()</code> methods is now optional
(:ticket:<code>[#716](https://github.com/psycopg/psycopg/issues/716)</code>).</li>
<li>Disable receiving more than one result on the same cursor in
pipeline mode,
to iterate through <code>~Cursor.nextset()</code>. The behaviour was
different than
in non-pipeline mode and not totally reliable
(:ticket:<code>[#604](https://github.com/psycopg/psycopg/issues/604)</code>).
The <code>Cursor</code> now only preserves the results set of the last
<code>~Cursor.execute()</code>, consistently with non-pipeline
mode.</li>
</ul>
<p>.. __: <a
href="https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types">https://numpy.org/doc/stable/reference/arrays.scalars.html#built-in-scalar-types</a></p>
<h2>Current release</h2>
<p>Psycopg 3.1.18
^^^^^^^^^^^^^^</p>
<ul>
<li>Fix possible deadlock on pipeline exit
(:ticket:<code>[#685](https://github.com/psycopg/psycopg/issues/685)</code>).</li>
<li>Fix overflow loading large intervals in C module
(:ticket:<code>[#719](https://github.com/psycopg/psycopg/issues/719)</code>).</li>
<li>Fix compatibility with musl libc distributions affected by
<code>CPython issue
[#65821](https://github.com/psycopg/psycopg/issues/65821)</code>__
(:ticket:<code>[#725](https://github.com/psycopg/psycopg/issues/725)</code>).</li>
</ul>
<p>.. __: <a
href="https://redirect.github.com/python/cpython/issues/65821">python/cpython#65821</a></p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/psycopg/psycopg/commit/8585a23fcd7bcf75193adbc10d3005752ba8f15f"><code>8585a23</code></a>
chore: bump psycopg package version to 3.1.18</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/ab646b70c82aafe6004064a40a3ba358142999a3"><code>ab646b7</code></a>
fix(c): drop spurious loop break in pipeline_communicate</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/bebfe97f934c9136e4db52709ac0fb4dd9cae64d"><code>bebfe97</code></a>
chore: bump cibuildwheel version</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/89394a6f36d42d308a8e672e9b5deef8e76254ae"><code>89394a6</code></a>
chore: bump checkout action to v4</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/ed579e51ca9b44af148e55d345e312f58ce12a6f"><code>ed579e5</code></a>
docs: fix tickets format</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/d4a4e8e1447de3446f614a29a8274ef7c4d03d64"><code>d4a4e8e</code></a>
Merge branch 'musl-ctypes' into maint-3.1</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/8bc51e6812cfaedebdd7afff7c86be301d5fbf66"><code>8bc51e6</code></a>
docs: mention musl-ctypes workaround in news file</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/afb040a800b2667a07dc441e8cdb94e55a0dcf65"><code>afb040a</code></a>
fix: add <code>libc.so</code> fallback for musl systems to the ctypes
impl</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/06ef0d92109a63fa1a7630804a3a26af0e0a39c9"><code>06ef0d9</code></a>
test: drop ineffective marker on fixture</li>
<li><a
href="https://github.com/psycopg/psycopg/commit/b955118e523c84f5f702d93fd74288ce51ff61db"><code>b955118</code></a>
Merge branch 'fix-interval-overflow' into maint-3.1</li>
<li>Additional commits viewable in <a
href="https://github.com/psycopg/psycopg/compare/3.1.15...3.1.18">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=psycopg&package-manager=pip&previous-version=3.1.15&new-version=3.1.18)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants