Trino

Driver Version v0.2.0 Tested With Trino 4nn

This driver provides access to Trino , a free and open-source distributed SQL query engine.

Installation

The Trino driver can be installed with dbc :

dbc install trino

Connecting

To use the driver, provide a Trino connection string as the uri option. The driver supports URI format and DSN-style connection strings, but URIs are recommended.

from adbc_driver_manager import dbapi

dbapi.connect(
  driver="trino",
  db_kwargs={
      "uri": "http://user@localhost:8080?catalog=tcph&schema=tiny"
  }
)

Note: The example above is for Python using the adbc-driver-manager package but the process will be similar for other driver managers.

Connection String Format

trino://[user[:password]@]host[:port][/catalog[/schema]][?attribute1=value1&attribute2=value2...]

Components:

  • Scheme: trino:// (required)

  • user: Optional (for authentication)

  • password: Optional (for authentication, requires user)

  • host: Required (no default)

  • port: Optional (defaults to 8080 for HTTP, 8443 for HTTPS)

  • catalog: Optional (Trino catalog name)

  • schema: Optional (schema within catalog)

  • Query params: Trino connection attributes

Note

Reserved characters in URI elements must be URI-encoded. For example, @ becomes %40. If you include a zone ID in an IPv6 address, the % character used as the separator must be replaced with %25.

HTTPS/SSL Configuration

HTTP Basic authentication is only supported on encrypted connections over HTTPS.

By default, connections use HTTPS. To connect using HTTP, add SSL=false as a query parameter:

  • trino://localhost:8080/catalog?SSL=false → Uses HTTP on port 8080

  • trino://localhost/catalog?SSL=false → Uses HTTP on default port 8080

  • trino://localhost:8443/catalog?SSL=true → Uses HTTPS on port 8443

  • trino://localhost:8080/catalog → Uses HTTPS on port 8080

  • trino://localhost/catalog → Uses HTTPS on default port 8443

See Trino JDBC Documentation for complete parameter reference and Trino Concepts for more information.

Examples:

  • trino://localhost:8080/hive/default

  • trino://user:pass@trino.example.com:8080/postgresql/public

  • trino://trino.example.com/hive/sales?SSL=true

  • trino://user@localhost:8443/memory/default?SSL=true&source=myapp

  • trino://user@localhost:8080/memory/default?session_properties=task_concurrency:2;query_priority:1

The driver also supports the Trino DSN format (see Go Trino Client documentation ), but URIs are recommended.

Feature & Type Support

Feature Support
Bulk Ingestion Create
Append
Create/Append
Replace
Temporary Table
Specify target catalog
Specify target schema
Non-nullable fields are marked NOT NULL
Catalog (GetObjects) depth=catalogs
depth=db_schemas
depth=tables
depth=columns (all)
Get Parameter Schema
Get Table Schema
Prepared Statements
Transactions

Types

Trino to Arrow

Trino Type

Arrow Type

BIGINT

int64

BOOLEAN

bool

DATE

date32[day]

DECIMAL

decimal64

DOUBLE PRECISION

double

INT

int32

INTERVAL DAY TO SECOND

month_day_nano_interval

INTERVAL YEAR TO MONTH

month_day_nano_interval

IPADDRESS

string

REAL

float

SMALLINT

int16

TIME

time64[us]

TIMESTAMP

timestamp[us]

TIMESTAMP WITH TIME ZONE

timestamp[us] (with time zone)

UUID

extension<arrow.uuid>

VARBINARY

binary

VARCHAR

string

Arrow to Trino

Arrrow Type Trino Type
Bind Ingest
binary

VARBINARY

binary_view

VARBINARY

bool

BOOLEAN

date32[day]

DATE

decimal128

DECIMAL

double

DOUBLE PRECISION

extension<arrow.uuid>

UUID

(not tested)

fixed_size_binary

VARBINARY

float

REAL

int16

SMALLINT

int32

INT

int64

BIGINT

large_binary

VARBINARY

large_string

VARCHAR

string

VARCHAR

string_view

VARCHAR

time32[ms]

TIME

time32[s]

TIME

time64[ns]

TIME

time64[us]

TIME

timestamp[ms]

TIMESTAMP(3)

timestamp[ms] (with time zone)

TIMESTAMP(3) WITH TIME ZONE

timestamp[ns]

TIMESTAMP(9)

timestamp[ns] (with time zone)

TIMESTAMP(9) WITH TIME ZONE

timestamp[s]

TIMESTAMP(0)

timestamp[s] (with time zone)

TIMESTAMP(0) WITH TIME ZONE

timestamp[us]

TIMESTAMP(6)

timestamp[us] (with time zone)

TIMESTAMP(6) WITH TIME ZONE

Compatibility

This driver was tested on the following versions of Trino:

  • Trino 477

Previous Versions

To see documentation for previous versions of this driver, see the following: