Usage

Creating a New TileDB Array

It is possible to create TileDB array from Trino. Not all array schema options are currently supported from Trino though (see Limitations for more details). An example is shown below.

create table my_table(
  dim0 bigint with (dimension=true, lower_bound=0, upper_bound=100, extent=10),
  dim1 bigint with (dimension=true, lower_bound=0, upper_bound=100, extent=10),
  attr1 varchar
  ) with (uri = '<array-uri>', type = 'SPARSE');

Note that <array-uri> can be any path, local (e.g., file://) or remote (e.g., s3://).

You can see the array schema as follows:

show create table tiledb.tiledb`<array-uri>`;

A TileDB array created through Trino is and behaves exactly like any other TileDB array. Therefore, it is accessible by all TileDB APIs (e.g., Python) and integrations (e.g., Spark).

Querying TileDB Arrays

Trino can dynamically discover existing TileDB arrays, i.e., even if they were created and populated externally from Trino. Therefore, you can just insert data into a TileDB array or query it as follows:

insert into tiledb.tiledb.<array-uri> (dim0, dim1, attr1) 
values (1, 1, 'cell 1'), (1, 2, 'cell 2'), (2, 1, 'cell 3');

// Read the array
select * from tiledb.tiledb.<array-uri>;

Trino uses the form of catalog.schema.<array-uri> for querying. TileDB does not have a concept of a table schema, so any valid string can be used for the schema name when querying and tiledb is used only for convenience in the examples. <array-uri> is the array URI and can be local (file://) or remote (s3://).

Last updated