Skip to content

SQLite

Install

Install ibis and dependencies for the SQLite backend:

pip install 'ibis-framework[sqlite]'
conda install -c conda-forge ibis-sqlite
mamba install -c conda-forge ibis-sqlite

Connect

API

Create a client by passing in a path to a SQLite database to ibis.sqlite.connect.

See ibis.backends.sqlite.Backend.do_connect for connection parameter information.

ibis.sqlite.connect is a thin wrapper around ibis.backends.sqlite.Backend.do_connect.

Connection Parameters

do_connect(database=None, path=None, type_map=None)

Create an Ibis client connected to a SQLite database.

Multiple database files can be accessed using the attach() method.

Parameters:

Name Type Description Default
database str | Path | None

File path to the SQLite database file. If None, creates an in-memory transient database and you can use attach() to add more files

None
path str | Path | None

Deprecated, use database

None
type_map dict[str, str | dt.DataType] | None

An optional mapping from a string name of a SQLite "type" to the corresponding ibis DataType that it represents. This can be used to override schema inference for a given SQLite database.

None

Examples:

>>> import ibis
>>> ibis.sqlite.connect("path/to/my/sqlite.db")

Backend API

Backend

Bases: BaseAlchemyBackend

Functions

attach(name, path)

Connect another SQLite database file to the current connection.

Parameters:

Name Type Description Default
name str

Database name within SQLite

required
path str | Path

Path to sqlite3 database file

required
table(name, database=None)

Create a table expression from a table in the SQLite database.

Parameters:

Name Type Description Default
name str

Table name

required
database str | None

Name of the attached database that the table is located in.

None

Returns:

Type Description
Table

Table expression


Last update: January 4, 2023