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 7025d6b6 test(python/adbc_driver_manager): update DuckDB integration 
tests (#1201)
7025d6b6 is described below

commit 7025d6b67652267c5133e823bf59ca642ee06670
Author: David Li <[email protected]>
AuthorDate: Fri Oct 13 13:42:36 2023 -0400

    test(python/adbc_driver_manager): update DuckDB integration tests (#1201)
    
    Fixes #1200.
---
 docs/source/driver/duckdb.rst                      |  17 ++--
 docs/source/python/recipe/driver_manager.rst       |   7 --
 docs/source/python/recipe/driver_manager_duckdb.py |  44 ---------
 python/adbc_driver_manager/tests/test_duckdb.py    | 100 ---------------------
 4 files changed, 6 insertions(+), 162 deletions(-)

diff --git a/docs/source/driver/duckdb.rst b/docs/source/driver/duckdb.rst
index f27d6062..ab109b81 100644
--- a/docs/source/driver/duckdb.rst
+++ b/docs/source/driver/duckdb.rst
@@ -45,16 +45,7 @@ ADBC support in DuckDB requires the driver manager.
    .. tab-item:: C++
       :sync: cpp
 
-      .. code-block:: cpp
-
-         #include "adbc.h"
-
-         // Ignoring error handling
-         struct AdbcDatabase database;
-         AdbcDatabaseNew(&database, nullptr);
-         AdbcDatabaseSetOption(&database, "driver", "PATH/TO/libduckdb.so", 
nullptr);
-         AdbcDatabaseSetOption(&database, "entrypoint", "duckdb_adbc_init", 
nullptr);
-         AdbcDatabaseInit(&database, nullptr);
+      See the `DuckDB C++ documentation`_.
 
    .. tab-item:: Go
       :sync: go
@@ -92,8 +83,12 @@ ADBC support in DuckDB requires the driver manager.
    .. tab-item:: Python
       :sync: python
 
-      See :ref:`recipe-driver-manager-duckdb`.
+      You must have DuckDB 0.9.1 or higher.
+
+      See the `DuckDB Python documentation`_.
 
+.. _DuckDB C++ documentation: https://duckdb.org/docs/api/adbc.html#c
+.. _DuckDB Python documentation: https://duckdb.org/docs/api/adbc.html#python
 
 Supported Features
 ==================
diff --git a/docs/source/python/recipe/driver_manager.rst 
b/docs/source/python/recipe/driver_manager.rst
index 71f0dc75..e819c010 100644
--- a/docs/source/python/recipe/driver_manager.rst
+++ b/docs/source/python/recipe/driver_manager.rst
@@ -18,10 +18,3 @@
 ======================
 Driver Manager Recipes
 ======================
-
-.. _recipe-driver-manager-duckdb:
-
-Load a driver from a shared library (DuckDB)
-============================================
-
-.. recipe:: driver_manager_duckdb.py
diff --git a/docs/source/python/recipe/driver_manager_duckdb.py 
b/docs/source/python/recipe/driver_manager_duckdb.py
deleted file mode 100644
index 84d4af2d..00000000
--- a/docs/source/python/recipe/driver_manager_duckdb.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# RECIPE STARTS HERE
-#: The ADBC driver manager can load a driver from a shared library.
-#: For drivers provided by the Arrow project, you don't need to worry
-#: about this; the Python package will take care of this for you.
-#: Other drivers may need configuration, though.  We'll use `DuckDB
-#: <https://duckdb.org>`_ as an example.
-
-import duckdb
-
-import adbc_driver_manager.dbapi
-
-#: The driver manager needs the path to the shared library.  It also
-#: needs the name of the entrypoint function.  Both of these should be
-#: found in the driver's documentation.
-conn = adbc_driver_manager.dbapi.connect(
-    driver=duckdb.__file__,
-    entrypoint="duckdb_adbc_init",
-)
-
-#: Once we provide that, everything else about the connection is the
-#: same as usual.
-
-with conn.cursor() as cur:
-    cur.execute("SELECT 1")
-    assert cur.fetchone() == (1,)
-
-conn.close()
diff --git a/python/adbc_driver_manager/tests/test_duckdb.py 
b/python/adbc_driver_manager/tests/test_duckdb.py
deleted file mode 100644
index 521ba23e..00000000
--- a/python/adbc_driver_manager/tests/test_duckdb.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# pyright: reportUnboundVariable=false
-# pyright doesn't like the optional import
-
-import sys
-
-import pyarrow
-import pytest
-
-from adbc_driver_manager import dbapi
-
-try:
-    import duckdb
-except ImportError:
-    pass
-
-pytestmark = pytest.mark.duckdb
-
-
[email protected]
-def conn():
-    if sys.platform.startswith("win"):
-        pytest.xfail("not supported on Windows")
-    with dbapi.connect(driver=duckdb.__file__, entrypoint="duckdb_adbc_init") 
as conn:
-        yield conn
-
-
[email protected]
-def test_connection_get_info(conn):
-    assert conn.adbc_get_info() != {}
-
-
-def test_connection_get_objects(conn):
-    with conn.cursor() as cursor:
-        cursor.execute("CREATE TABLE getobjects (ints BIGINT)")
-    assert conn.adbc_get_objects(depth="all").read_all().to_pylist() != []
-
-
[email protected]
-def test_connection_get_table_schema(conn):
-    with conn.cursor() as cursor:
-        cursor.execute("CREATE TABLE tableschema (ints BIGINT)")
-    assert conn.adbc_get_table_schema("tableschema") == pyarrow.schema(
-        [
-            ("ints", "int64"),
-        ]
-    )
-
-
-def test_connection_get_table_types(conn):
-    assert conn.adbc_get_table_types() == []
-
-
[email protected]
-def test_statement_ingest(conn):
-    table = pyarrow.table(
-        [
-            [1, 2, 3, 4],
-            ["a", "b", None, "d"],
-        ],
-        names=["ints", "strs"],
-    )
-    with conn.cursor() as cursor:
-        cursor.adbc_ingest("ingest", table)
-        cursor.execute("SELECT * FROM ingest")
-        assert cursor.fetch_arrow_table() == table
-
-
-def test_statement_prepare(conn):
-    with conn.cursor() as cursor:
-        cursor.adbc_prepare("SELECT 1")
-        cursor.execute("SELECT 1")
-        assert cursor.fetchone() == (1,)
-        assert cursor.fetchone() is None
-
-
-def test_statement_query(conn):
-    with conn.cursor() as cursor:
-        cursor.execute("SELECT 1")
-        assert cursor.fetchone() == (1,)
-        assert cursor.fetchone() is None
-
-        cursor.execute("SELECT 1 AS foo")
-        assert cursor.fetch_arrow_table().to_pylist() == [{"foo": 1}]

Reply via email to