You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/12/02 18:04:32 UTC

[arrow-adbc] branch main updated: chore(c/driver/postgres,c/driver/sqlite): fix DeprecationWarning in Python bindings (#211)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 2a6675a  chore(c/driver/postgres,c/driver/sqlite): fix DeprecationWarning in Python bindings (#211)
2a6675a is described below

commit 2a6675a304f73b0dc35a6dcb37402ccb38cfcd80
Author: David Li <li...@gmail.com>
AuthorDate: Fri Dec 2 13:04:26 2022 -0500

    chore(c/driver/postgres,c/driver/sqlite): fix DeprecationWarning in Python bindings (#211)
    
    Fixes #205.
---
 python/adbc_driver_manager/pyproject.toml                    |  4 ++--
 python/adbc_driver_postgres/adbc_driver_postgres/__init__.py |  7 +++----
 python/adbc_driver_postgres/pyproject.toml                   |  2 +-
 python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py     | 11 +++++------
 python/adbc_driver_sqlite/pyproject.toml                     |  2 +-
 5 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/python/adbc_driver_manager/pyproject.toml b/python/adbc_driver_manager/pyproject.toml
index fd4d168..ee12b0d 100644
--- a/python/adbc_driver_manager/pyproject.toml
+++ b/python/adbc_driver_manager/pyproject.toml
@@ -17,10 +17,10 @@
 
 [project]
 name = "adbc_driver_manager"
-description = ""
+description = "A generic entrypoint for ADBC drivers."
 authors = [{name = "Apache Arrow Developers", email = "dev@arrow.apache.org"}]
 license = {text = "Apache-2.0"}
-requires-python = ">=3.8"
+requires-python = ">=3.9"
 dynamic = ["version"]
 
 [project.optional-dependencies]
diff --git a/python/adbc_driver_postgres/adbc_driver_postgres/__init__.py b/python/adbc_driver_postgres/adbc_driver_postgres/__init__.py
index c9609ce..529808f 100644
--- a/python/adbc_driver_postgres/adbc_driver_postgres/__init__.py
+++ b/python/adbc_driver_postgres/adbc_driver_postgres/__init__.py
@@ -26,7 +26,6 @@ __all__ = ["connect", "__version__"]
 
 def connect(uri: str) -> adbc_driver_manager.AdbcDatabase:
     """Create a low level ADBC connection to Postgres."""
-    with importlib.resources.path(
-        __package__, "libadbc_driver_postgres.so"
-    ) as entrypoint:
-        return adbc_driver_manager.AdbcDatabase(driver=str(entrypoint), uri=uri)
+    root = importlib.resources.files(__package__)
+    entrypoint = root.joinpath("libadbc_driver_postgres.so")
+    return adbc_driver_manager.AdbcDatabase(driver=str(entrypoint), uri=uri)
diff --git a/python/adbc_driver_postgres/pyproject.toml b/python/adbc_driver_postgres/pyproject.toml
index ec425b3..35a4331 100644
--- a/python/adbc_driver_postgres/pyproject.toml
+++ b/python/adbc_driver_postgres/pyproject.toml
@@ -20,7 +20,7 @@ name = "adbc_driver_postgres"
 description = "A libpq-based ADBC driver for working with Postgres."
 authors = [{name = "Apache Arrow Developers", email = "dev@arrow.apache.org"}]
 license = {text = "Apache-2.0"}
-requires-python = ">=3.8"
+requires-python = ">=3.9"
 dynamic = ["version"]
 
 [project.optional-dependencies]
diff --git a/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py b/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py
index c01ea88..184fb46 100644
--- a/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py
+++ b/python/adbc_driver_sqlite/adbc_driver_sqlite/__init__.py
@@ -27,9 +27,8 @@ __all__ = ["connect", "__version__"]
 
 def connect(uri: typing.Optional[str] = None) -> adbc_driver_manager.AdbcDatabase:
     """Create a low level ADBC connection to SQLite."""
-    with importlib.resources.path(
-        __package__, "libadbc_driver_sqlite.so"
-    ) as entrypoint:
-        if uri is None:
-            return adbc_driver_manager.AdbcDatabase(driver=str(entrypoint))
-        return adbc_driver_manager.AdbcDatabase(driver=str(entrypoint), uri=uri)
+    root = importlib.resources.files(__package__)
+    entrypoint = root.joinpath("libadbc_driver_sqlite.so")
+    if uri is None:
+        return adbc_driver_manager.AdbcDatabase(driver=str(entrypoint))
+    return adbc_driver_manager.AdbcDatabase(driver=str(entrypoint), uri=uri)
diff --git a/python/adbc_driver_sqlite/pyproject.toml b/python/adbc_driver_sqlite/pyproject.toml
index ea720f5..c556045 100644
--- a/python/adbc_driver_sqlite/pyproject.toml
+++ b/python/adbc_driver_sqlite/pyproject.toml
@@ -20,7 +20,7 @@ name = "adbc_driver_sqlite"
 description = "An ADBC driver for working with SQLite."
 authors = [{name = "Apache Arrow Developers", email = "dev@arrow.apache.org"}]
 license = {text = "Apache-2.0"}
-requires-python = ">=3.8"
+requires-python = ">=3.9"
 dynamic = ["version"]
 
 [project.optional-dependencies]