Time Traveling

You can open or reopen an array at a particular timestamp, if for example you'd like to see a view of the array in the past. See Time Traveling for more details. You can do so as follows:

C
C++
Python
R
Java
Go
C
// ... create context ctx
// Open at a timestamp
uint64_t timestamp = 1561492235844; // In ms
tiledb_array_alloc(ctx, "<array-uri>", &array);
tiledb_array_open_at(ctx, array, TILEDB_WRITE, timestamp);
// Or, ppen encrypted array with key at timestamp
const char key[] = "0123456789abcdeF0123456789abcdeF";
tiledb_array_t* array;
tiledb_array_alloc(ctx, "<array-uri>", &array);
tiledb_array_open_at_with_key(
ctx, array, TILEDB_WRITE, TILEDB_AES_256_GCM, key, sizeof(key), timestamp);
C++
// ... create context ctx
// Open at a timestamp
uint64_t timestamp = 1561492235844; // In ms
Array array(ctx, "<array-uri>", TILEDB_WRITE, timestamp);
// Or, open encrypted array with key at timestamp
const char key[] = "0123456789abcdeF0123456789abcdeF";
Array array(ctx, "<array-uri>", TILEDB_WRITE, TILEDB_AES_256_GCM, key, sizeof(key), timestamp);
Python
timestamp = 1561492235844 # time in ms
# Array constructors support a `timestamp` keyword argument
A = tiledb.DenseArray(uri, timestamp=timestamp)
A = tiledb.SparseArray(uri, timestamp=timestamp)
# Or, open encrypted array with key at timestamp
key = "0123456789abcdeF0123456789abcdeF"
A = tiledb.DenseArray(uri, key=key, timestamp=timestamp)
A = tiledb.SparseArray(uri, key=key, timestamp=timestamp)
R
ctx <- tiledb_ctx()
tstamp <- Sys.time() - 60*60 # one hour ago
arrptr <- tiledb:::libtiledb_array_open_at(ctx@ptr, uridense,
"READ", tstamp)
subarr <- c(1L,2L, 2L,4L)
qryptr <- tiledb:::libtiledb_query(ctx@ptr, arrptr, "READ")
qryptr <- tiledb:::libtiledb_query_set_subarray(qryptr, subarr)
qryptr <- tiledb:::libtiledb_query_set_layout(qryptr,
"ROW_MAJOR")
v <- integer(6) # reserve space
qryptr <- tiledb:::libtiledb_query_set_buffer(qryptr, "a", v)
qryptr <- tiledb:::libtiledb_query_submit(qryptr)
res <- tiledb:::libtiledb_array_close(arrptr)
v
Java
// TODO: Time traveling is not currently supported in the Java API
Go
// ... create context ctx
// Open at a timestamp
var timestamp uint64 = 1561492235844; // In ms
array.OpenAt(TILEDB_ERITE, timestamp)
// Or, open encrypted array with key at timestamp
var key := "0123456789abcdeF0123456789abcdeF"
array.OpenWithKey(TILEDB_READ, TILEDB_AES_256_GCM, key)