How do you define a primary key on a table in Trino?
Asked Answered
M

1

5

The query below does not work.

CREATE TABLE test_table (date varchar, id varchar, PRIMARY KEY (date,id)) 

I can't seem to find any docs on primary keys in Trino.

Midget answered 11/11, 2022 at 0:3 Comment(0)
C
6

You don't. As the description says:

Trino is a distributed SQL query engine designed to query large data sets distributed over one or more heterogeneous data sources.

Trino does not maintain primary keys, indexes and so on. See also use cases and Trino concepts.

Ciri answered 11/11, 2022 at 0:50 Comment(2)
delta lake has foreign keys now, but not supported in trino yet. maybe down the road? would be handy for tools like metabase where you should specify your keysPhotocompose
@NeilMcGuigan I doubt it, since Trino is a query engine which does not usually stores the data (unlike delta lake) but processes it.Ciri

© 2022 - 2024 — McMap. All rights reserved.