Asynchronous queries have known feature gaps and reliability issues and are deprecated as of TileDB 2.14.
You can perform queries (reads or writes) asynchronously as follows:
// ... create read or write query
// Callback that simply prints the input string to stdout
void print_upon_completion(void* s) {
printf("%s\n", (char*)s);
}
// Instead of using tiledb_query_submit(), use tiledb_query_submit_async()
// and pass a callback function
char s[100] = "Callback: Query completed";
tiledb_query_submit_async(ctx, query, print_upon_completion, s);
// ... create read or write query
// Instead of using query.submit(), use query.submit_async()
// and optionally pass a callback function
query.submit_async([]() { std::cout << "Callback: Query completed\n"; });
# TODO: Asynchronous queries are not yet supported in the Python API
# ... create read or write query
# Instead of using tiledb_query_submit(), use tiledb_query_submit_async()
# There is an alternate form with a callback function which is not yet supported
tiledb_query_submit_async(qry)
private class ReadCallback implements Callback {
public ReadCallback() {}
public void call() {
System.out.println("Callback: Query completed");
}
}
// Submit query with callback
query.submitAsync(new ReadCallback());
// ... create read or write query
// Instead of using Submit(), use SubmitAsync()
err = query.SubmitAsync()
fmt.Println("Read query in progress")
// Wait for status to return complete or to error
// Loop while status is inprogress
for status, err := query.Status(); status == tiledb.TILEDB_INPROGRESS &&
err == nil; status,
err = query.Status() {
// Do something while query is running
}
fmt.Println("Callback: Read query completed")