Creating a New TileDB Array

The example below demonstrates creation of a TileDB array through Presto. Note that some array schema options are not currently supported from Presto (see Limitations for more details).

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');

<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 PrestoDB 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

PrestoDB can dynamically discover existing TileDB arrays, i.e., even if they were created and populated externally from PrestoDB. 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>;

Presto 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