Search code examples
sqldockerprestotrino

Trino create custom table


I am running Trino with a docker container and I want to edit the catalogs or more specific the tables.

I followed these instructions: https://trino.io/docs/current/installation/containers.html

When I run

docker run --name trino -d -p 8080:8080 trinodb/trino and then docker exec -it trino trino I can do select statements and so on, but I want to be able to create a custom table. When I try to do so, I get this:

trino> create table tpch.sf1.test (id int);
Query 20240711_100824_00000_y8ghb failed: This connector does not support creating tables

I also tried this: docker run --name trino -d -p 8080:8080 --volume $PWD/etc:/etc/trino/catalog trinodb/trino

When I create a catalog, I get this:

create catalog tpch using tpch;
Query 20240711_101526_00002_u8xak failed: CREATE CATALOG is not supported by the static catalog store

Solution

  • TPCH is a readonly connector which can be used for testing queries and benchmarking:

    This connector can be used to test the capabilities and query syntax of Trino without configuring access to an external data source. When you query a TPCH schema, the connector generates the data on the fly using a deterministic algorithm.

    You need to use some other connector, for example using the Memory one:

    create schema memory.test; -- using default memory catalog
    use memory.test;
    CREATE TABLE orders (
      orderkey bigint,
      orderstatus varchar,
      totalprice double,
      orderdate date
    );
    show tables;
    

    Output:

     Table  
    --------
     orders