Getting the Written Fragment Info

A write operation can create one or more fragments. You can get information about the written fragments as follows:

C
C++
Python
R
Java
Go
C
// ... create context ctx
// ... create query
// Get the number of written fragments
unsigned int num;
tiledb_query_get_fragment_num(ctx, query, &num);
// Get the fragment URI by index (0 <= idx < num)
const char* uri;
tiledb_query_get_fragment_uri(ctx, query, idx, &uri);
// Get the timestamp range by index (0 <= idx < num)
unsigned long long t1, t2;
tiledb_query_get_fragment_timestamp_range(ctx, query, idx, &t1, &t2);
C++
// ... create query
// Get the number of written fragments
uint32_t num = query.fragment_num();
// Get the fragment URI by index (0 <= idx < num)
std::string uri = query.fragment_uri(idx);
// Get the timestamp range by index (0 <= idx < num)
std::pair<uint64_t, uint64_t> range = query.fragment_timestamp_range(idx);
Python
with tiledb.DenseArray(array_name, 'w') as A:
A[:] = data
# returns a dict of {filename: (timestamp1,timestamp2)}
print(A.last_write_info)
R
# Continuing from previous example on dense variable length array
# (but this works with any array after a write)
# Number of fragments
numfrag <- tiledb_query_get_fragment_num(qry)
# URI of given fragment, with 0 <= idx < numfrag
uri <- tiledb_query_get_fragment_uri(qry, idx)
# Timestamp range of given fragment, with 0 <= idx < numfrag
tsrange <- tiledb_query_get_fragment_timestamp_range(qry, idx)
Java
// ... create query
// Get the number of written fragments
long num = query.getFragmentNum();
// Get the fragment URI by index (0 <= idx < num)
String uri = query.getFragmentURI(idx);
// Get the timestamp range by index (0 <= idx < num)
Pair<Long, Long> range = query.getFragmentTimestampRange(idx);
Go
// ... create context ctx
// ... create write query
// ... submit write query
// Get the number of written fragments
num, _ := query.GetFragmentNum()
// Get the fragment URI by index (0 <= idx < num)
uri, _ := query.GetFragmentURI(idx)
// Get the timestamp range by index (0 <= idx < num)
t1, t2, _ := query.GetFragmentTimestampRange(idx)