Usage
Creating TileDB Arrays
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. Note that filters are optional for creating a table.
If you wish to create an array on S3, the command is similar. Only the array name needs to change to an S3 URI:
You can see the array schema as follows:
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:
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:
Encrypted TileDB Arrays
MyTile supports querying encrypted TileDB arrays by passing the encryption key as a parameter to the assisted table discovery. Note that due to a limitation of MariaDB, if you pass an encryption key it will be shown in the create table statement for any MariaDB user which has permissions to view the created table.
Querying Array Metadata
Array metadata can be queried using a special suffix for the array URI. Adding @metadata
to the URI will trigger MyTile to query the array metadata instead of the array data. The results are returned in two columns, key
and value
, both with string (TEXT
) datatype in MariaDB. If a metadata value contains more than one value then a comma delimited string is returned.
Time Traveling
Time traveling for TileDB arrays is supported in two methods.
Dynamic Discovery With @timestamp
You can use the @<timestamp>
keyword on the array URI to trigger MyTile to query the array at the given timestamp. This is equivalent to using open_at
in other APIs.
Create Table
You can also use time traveling with the open_at=<timestamp>
parameter with create table discovery.
Geospatial Data
You can also use certain geospatial functions that leverage the performance benefits of TileDB. These are: ST_Intersects
, ST_Overlaps
, ST_Equals.
In addtion, all of the standard MariaDB spatial functions are available.
Loading data to arrays with geometry types
You can load data into your TileDB arrays using either the OGR TileDB driver or the TileDB-Py API.
Query TileDB arrays
If your wkb_geometry
column is paired with a spatial index as created by the OGR TileDB driver, the spatial filter will be pushed down to take advantage of TileDB's powerful dimension slicing for a significant performance boost. Without the spatial index, queries will return the same results but using a full scan.
The examples below show the geospatial functions we push down to TileDB. These queries can run on arrays created by MyTile, by TileDB Open Source, or any other of our supported APIs and integrations.
Visual representation:
In order for TileDB to identify the spatial data attribute, your array must either have an attribute named "wkb_geometry" or have a "GEOMETRY_ATTRIBUTE_NAME" metadata field that specifies the name of the spatial attribute.
Last updated