Array Access

For reads, writes, embedded SQL, any integration and any API, you can simply use TileDB Embedded with only two changes:

  • Set the TileDB configuration parameters rest.username and rest.passwordwith your TileDB Cloud username and password, or alternatively rest.tokenwith the API token you created.

  • Every array registered with TileDB Cloud must be accessed using a URI of the form tiledb://<namespace>/<array-name>, where<namespace> is the user or organization who owns the array and <array-name> is the array name set by the owner upon array registration. This URI is displayed on the console when viewing the array details.

Accessing arrays by setting an API token is typically faster than using your username and password.

Here are some Python examples, although the above changes will work with any TileDB API or integration:

import tiledb, tiledb.sql
import pandas
# Create the configuration parameters
config = tiledb.Config()
config["rest.username"] = "xxx"
config["rest.password"] = "yyy"
# or, more preferably, config["rest.token"] = "ttt"
# This is the array URI format in TileDB Cloud
array_name = "tiledb://TileDB-Inc/quickstart_sparse"
# Write code exactly as in TileDB Developer
with, 'r', ctx=tiledb.Ctx(config)) as A:
print (A.df[:])
# Using embedded SQL, you need to pass the username/password or token
# as config parameters in `init_command`
db = tiledb.sql.connect(db="test",
init_command="set mytile_tiledb_config='rest.username=xxx,rest.password=yyy'")
pandas.read_sql(sql="select * from `tiledb://TileDB-Inc/quickstart_sparse`", con=db)

You can create an array inside or outside TileDB Cloud. The benefit of creating an array with TileDB Cloud is that it will be logged for auditing purposes. Moreover, it will be registered automatically with your account upon creation.

To instruct TileDB Embedded that you are creating an array through the TileDB Cloud service, you just need a single change:

  • Instead of using <array-uri> as you would typically in TileDB Embedded, you must use tiledb://<username>/<array-uri>. For example, if you wish to create an array at s3://my_bucket/my_array, you need to set the array URI to tiledb://my_username/s3://my_bucket/my_array.