Array Access

For reads, writes, embedded SQL, any integration and any API, you can use TileDB as in TileDB Developer 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 (see Creating API Tokens).

  • Every array registered with TileDB Cloud must be accessed by 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:

Python
import tiledb, tiledb.sql
import pandas
# Create the configuration parameters
config = tiledb.Config()
config["rest.username"] = "my_username"
config["rest.password"] = "my_password"
# or, more preferably, config["rest.token"] = "my_token"
# This is the array URI format in TileDB Cloud
array_name = "tiledb://TileDB-Inc/quickstart_sparse"
# Write code exactly as in TileDB Developer
with tiledb.SparseArray(array_name, 'r', ctx=tiledb.Ctx(config)) as A:
data = A[:]
print (pandas.DataFrame(data))
# Using embedded SQL, you need to pass the username/password as config parameters in `init_command`
db = tiledb.sql.connect(db="test",
init_command="set mytile_tiledb_config='rest.username=xxx,rest.password=xxx,rest.server_address=https://api.tiledb.com,...'")
pandas.read_sql(sql="select * from `<array_uri>`", 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 auditability purposes. Moreover, it will be registered automatically with your account upon creation.

To instruct TileDB Developer 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 Developer, 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.