I have following code:
#include <tiledb/tiledb>
#include
#includeusing namespace tiledb;
// Name of array.
Config config;
// Set a configuration parameter
std::string array_name(“s3://kunal-test-bucketing/quickstart_dense_array”);void create_array() {
// Create a TileDB context.
tiledb::Config cfg;Context ctx(cfg);
// The array will be 4x4 with dimensions “d1” and “d2”, with domain [1,4].
Domain domain(ctx);
domain.add_dimension(Dimension::create(ctx, “d1”, {{1, 4}}, 4))
.add_dimension(Dimension::create(ctx, “d2”, {{1, 4}}, 4));cfg[“vfs.s3.region”] = “us-west-1”;
// The array will be dense.
ArraySchema schema(ctx, TILEDB_DENSE);
schema.set_domain(domain)
.set_order({{TILEDB_ROW_MAJOR, TILEDB_ROW_MAJOR}});// Add a single attribute “a” so each (i,j) cell can store an integer.
schema.add_attribute(Attribute::create(ctx, “a”));// Create the (empty) array on disk.
Array::create(array_name, schema);
}
void write_array() {
Context ctx;// Prepare some data for the array
std::vector data = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};// Open the array for writing and create the query.
Array array(ctx, array_name, TILEDB_WRITE);
Query query(ctx, array);
query.set_layout(TILEDB_ROW_MAJOR)
.set_buffer(“a”, data);// Perform the write and close the array.
query.submit();
array.close();
}void read_array() {
Context ctx;// Prepare the array for reading
Array array(ctx, array_name, TILEDB_READ);// Slice only rows 1, 2 and cols 2, 3, 4
const std::vector subarray = {1, 2, 2, 4};// Prepare the vector that will hold the result (of size 6 elements)
std::vector data(6);// Prepare the query
Query query(ctx, array);
query.set_subarray(subarray)
.set_layout(TILEDB_ROW_MAJOR)
.set_buffer(“a”, data);// Submit the query and close the array.
query.submit();
array.close();// Print out the results.
for (auto d : data)
std::cout << d << " ";
std::cout << “\n”;
}int main()
{
create_array();
write_array();
read_array();
return 0;
}
As you can see I am basically picking up code as it is from your examples on tile-db website. I have the following set up.
My Access_key and secret are set up inside the credential file. I am able to run this code and create and read from the array all fine AS FAR AS the bucket is on us-east-1
please note here that in my ~/.aws/config file my and environment variable AWS_DEFAULT_REGION
are both set to us-west-1 also as you can see in the code, I am also trying to override the value if set to anything else to us-west-1 by doing cfg["vfs.s3.region"] = "us-west-1";
After setting all the possible places which could possibly provide the region value, I was hoping that it would be able to connect to a bucket in us-west-1 region but unfortunately, it did not happen.’
However, I am able to change the s3 link to a bucket in us-east-1 which is the tile-db default and it would work all fine. This tells me that tile-db api is not able to override on the region.
Any thoughts?