-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #874.
- Loading branch information
Showing
5 changed files
with
140 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
.. 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. | ||
============== | ||
DuckDB Support | ||
============== | ||
|
||
**Available for:** C/C++, GLib/Ruby, Go, Python | ||
|
||
`DuckDB`_ provides ADBC support since `version 0.8.0 | ||
<https://duckdb.org/2023/05/17/announcing-duckdb-080.html>`_. | ||
|
||
.. note:: DuckDB is not part of the Apache Arrow project and is | ||
developed separately. | ||
|
||
.. _DuckDB: https://duckdb.org/ | ||
|
||
Installation | ||
============ | ||
|
||
See the `DuckDB documentation | ||
<https://duckdb.org/docs/installation/>`_. | ||
|
||
Usage | ||
===== | ||
|
||
ADBC support in DuckDB requires the driver manager. | ||
|
||
.. tab-set:: | ||
|
||
.. 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); | ||
.. tab-item:: Go | ||
:sync: go | ||
|
||
You must have ``libduckdb.so`` on your ``LD_LIBRARY_PATH``, or | ||
in the same directory as the executable when you run this. This | ||
requires CGO and loads the DuckDB driver. | ||
|
||
.. code-block:: go | ||
import ( | ||
"context" | ||
"github.com/apache/arrow-adbc/go/adbc" | ||
"github.com/apache/arrow-adbc/go/adbc/drivermgr" | ||
) | ||
func main() { | ||
var drv drivermgr.Driver | ||
db, err := drv.NewDatabase(map[string]string{ | ||
"driver": "libduckdb.so", | ||
"entrypoint": "duckdb_adbc_init", | ||
}) | ||
if err != nil { | ||
// handle error | ||
} | ||
cnxn, err := db.Open(context.Background()) | ||
if err != nil { | ||
// handle error | ||
} | ||
defer cnxn.Close() | ||
} | ||
.. tab-item:: Python | ||
:sync: python | ||
|
||
See :ref:`recipe-driver-manager-duckdb`. | ||
|
||
|
||
Supported Features | ||
================== | ||
|
||
ADBC support in DuckDB is still in progress. See `duckdb/duckdb#7141 | ||
<https://github.com/duckdb/duckdb/issues/7141>`_ for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters