Skip to main content

Trino Reference

Authentication options and data type handling for Trino connections.

Server​

servers:
- server: trino
type: trino
host: localhost
port: 8080
catalog: my_catalog
schema: my_schema

Authentication​

VariableExampleDescription
DATACONTRACT_TRINO_USERNAMEtrinoUsername for basic auth
DATACONTRACT_TRINO_PASSWORDmysecretpasswordPassword for basic auth
DATACONTRACT_TRINO_AUTHENTICATIONoauth2basic (default), jwt, or oauth2
DATACONTRACT_TRINO_JWT_TOKENeyJhbGciOi...JWT bearer token for jwt auth

host, port, catalog, and schema come from the contract's servers block, and can be overridden with DATACONTRACT_TRINO_HOST, DATACONTRACT_TRINO_PORT, DATACONTRACT_TRINO_CATALOG, and DATACONTRACT_TRINO_SCHEMA.

Data types​

Importing​

There is no direct Trino importer. Import a SHOW CREATE TABLE DDL with datacontract import sql --dialect postgres (Trino's ANSI-style DDL generally parses with the postgres dialect): VARCHAR/CHAR → string, INTEGER/BIGINT/SMALLINT/TINYINT → integer, DECIMAL/DOUBLE/REAL → number, BOOLEAN → boolean, DATE → date, TIME → time, TIMESTAMP → timestamp, ARRAY(...) → array, JSON → object.

Testing​

Trino supports native type introspection: the declared physicalType is checked against information_schema.columns. Length/precision is only enforced when the contract declares it (varchar matches varchar(10)); timezone variants of timestamps are interchangeable. A physicalType that isn't valid Trino SQL falls back to the logical type category comparison.

Logical type mapping​

When no physicalType is declared, the CLI derives the native type from the logicalType — for example in datacontract export sql and the dbt exports. This table is generated from the converter in the CLI's code:

logicalTypeTrino type
stringvarchar
integerinteger
numberdecimal
booleanboolean
datedate
timestamptimestamp(3) with time zone
timetime
objectjson
arrayjson
mapmap(varchar, varchar)
vectorarray(real)