Python Notebooks
July 22, 2026 ยท View on GitHub
dbc can be installed and used directly in Python notebooks (such as Jupyter or Google Colab). Each of the following code blocks is designed to be executed as an individual cell in your notebook.
Install the dbc, adbc-driver-manager, and pyarrow packages:
%pip install dbc adbc_driver_manager pyarrow
Install the duckdb driver:
!dbc install duckdb
!!! note
This guide uses the [DuckDB driver](https://arrow.apache.org/adbc/current/driver/duckdb.html) for simplicity.
To list all available drivers, run `!dbc search`. See the [Finding Drivers](./finding_drivers.md) guide for more information.
Import the dbapi module from the ADBC driver manager:
from adbc_driver_manager import dbapi
Connect to a database via ADBC, create a cursor, execute queries, and fetch the result as a PyArrow Table:
with (
dbapi.connect(driver="duckdb") as con,
con.cursor() as cursor,
):
cursor.execute("CREATE TABLE IF NOT EXISTS penguins AS FROM 'https://blobs.duckdb.org/data/penguins.csv'")
cursor.execute("SELECT * FROM penguins")
table = cursor.fetch_arrow_table()
Print the table:
print(table)