Usage

Creating a New TileDB Array

The following example shows you how to create a 2D sparse TileDB array with a single attribute. See Configuration Parameters for details on the MyTile and core TileDB options you can set.

SQL
create table test_array (
dim0 integer DIMENSION=1 lower_bound="0" upper_bound="100" tile_extent="10",
dim1 integer DIMENSION=1 lower_bound="0" upper_bound="100" tile_extent="10",
attr1 varchar(255)
) engine=MyTile array_type='SPARSE';

If you wish to create an array on S3, the command is similar:

SQL
create table `<s3-array-uri>` (
dim0 integer DIMENSION=1 lower_bound="0" upper_bound="100" tile_extent="10",
dim1 integer DIMENSION=1 lower_bound="0" upper_bound="100" tile_extent="10",
attr1 varchar(255)
) engine=MyTile uri=`<s3-array-uri>` array_type='SPARSE';

You can see the array schema as follows:

SQL
show create table `<array-uri>`;

A TileDB array created through MariaDB 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

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

SQL
// Insert some values
insert into test_array (dim0, dim1, attr1)
values (1, 1, "cell 1"), (1, 2, "cell 2"), (2, 1, "cell 3");
// Read the array
select * from test_array;

Note that, if your array URI is longer than 64 characters, you need to use MariaDB's assisted table discovery for long names by simply doing the following:

SQL
// The following does not create an array, it just informs MariaDB about its existence
create table my_array
engine=mytile uri='s3://my_bucket/arrays/sub_prefix/path_is_longer_than_64_chars/my_array_1';
// Now you can query the array using the new short name
select * from my_array;