Skip to content

Commit

Permalink
docs: clarify that driver manager is probably not what you want
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Jul 10, 2024
1 parent fb61e9e commit 15e34d5
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions docs/source/python/driver_manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,34 @@ Installation
Usage
=====

First create a :py:class:`AdbcDatabase`, passing ``driver`` and
(optionally) ``entrypoint``. ``driver`` must be the name of a library
to load, or the path to a library to load. ``entrypoint``, if
provided, should be the name of the symbol that serves as the ADBC
.. warning:: This API is for low level usage only. **You almost certainly
should not use this**, instead use the entrypoints provided by
driver packages, for example:

- :func:`adbc_driver_sqlite.dbapi.connect`
- :func:`adbc_driver_sqlite.connect`

The Python bindings for each driver abstract the steps here for you behind a
convenient ``connect`` function. For example, prefer
:func:`adbc_driver_sqlite.connect` or :func:`adbc_driver_postgresql.connect`
to manually constructing the connection as demonstrated here.

To manually create a connection: first, create a :py:class:`AdbcDatabase`,
passing ``driver`` and (optionally) ``entrypoint``. ``driver`` must be the
name of a library to load, or the path to a library to load. ``entrypoint``,
if provided, should be the name of the symbol that serves as the ADBC
entrypoint (see :cpp:type:`AdbcDriverInitFunc`). Then, create a
:py:class:`AdbcConnection`.

.. code-block:: python
import adbc_driver_manager
with adbc_driver_manager.AdbcDatabase(driver="adbc_driver_sqlite") as db:
# You must build/locate the driver yourself
with adbc_driver_manager.AdbcDatabase(driver="PATH/TO/libadbc_driver_sqlite.so") as db:
with adbc_driver_manager.AdbcConnection(db) as conn:
pass
The Python bindings for each driver abstract these steps for you
behind a convenient ``connect`` function.

API Reference
=============

Expand Down

0 comments on commit 15e34d5

Please sign in to comment.