Skip to content

Trino

exportbadge

Introduced in v4.0

The Trino backend is experimental and is subject to backwards incompatible changes.

ibis.memtable Support memtable

The Trino backend supports memtables by constructing a string with the contents of the in-memory object. This will be very inefficient for medium to large in-memory tables. Please file an issue if you observe performance issues when using in-memory tables.

Install

Install ibis and dependencies for the Trino backend:

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

Connect

ibis.trino.connect

con = ibis.trino.connect(
    user="user",
    password="password",
    port=8080,
    database="database",
    schema="default",
)

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

Connection Parameters

do_connect(user='user', password=None, host='localhost', port=8080, database=None, schema=None, source=None, **connect_args)

Connect to Trino.

Parameters:

Name Type Description Default
user str

Username to connect with

'user'
password str | None

Password to connect with

None
host str

Hostname of the Trino server

'localhost'
port int

Port of the Trino server

8080
database str | None

Catalog to use on the Trino server

None
schema str | None

Schema to use on the Trino server

None
source str | None

Application name passed to Trino

None
connect_args

Additional keyword arguments passed directly to SQLAlchemy's create_engine

{}

Examples:

>>> catalog = "hive"
>>> schema = "default"

Connect using a URL, with the default user, password, host and port

>>> con = ibis.connect(f"trino:///{catalog}/{schema}")

Connect using a URL

>>> con = ibis.connect(f"trino://user:password@host:port/{catalog}/{schema}")

Connect using keyword arguments

>>> con = ibis.trino.connect(database=catalog, schema=schema)
>>> con = ibis.trino.connect(database=catalog, schema=schema, source="my-app")

Last update: August 1, 2023