Groups

Creating TileDB Groups

TileDB allows you to hierarchically organize your arrays in groups. A group is a directory with a __tiledb_group.tdb marker file and additional folders containing metadata and group-member URIs; see here for further description of the contents and layout. This offers an intuitive and familiar way to store your various TileDB objects in persistent storage. You can create a group simply as follows:

// ... create context ctx

// Create group
tiledb_group_create(ctx, "my_group");

You can hierarchically organize TileDB groups similar to your filesystem directories, i.e., groups can be arbitrarily nested in other groups.

Using Group Metadata

# open the group for reading
with tiledb.Group(URI) as g:
    # g.meta is a dictionary
    # get value:
    g.meta[key] # -> value

# open the group for writing
with tiledb.Group(URI, "w") as g:
    # set value:
    g.meta[key] = value
    
    del g.meta[key]

Add/Remove Members

TileDB Arrays act like group members. They can be added or removed in the following way:

// Create some test members
arrayCreate("array1");
arrayWrite("array1");

arrayCreate("array2");
arrayWrite("array2");

arrayCreate("array3");
arrayWrite("array3");

// Create a group and open in WRITE mode
Group.create(ctx, "test_group");
Group group = new Group(ctx, "test_group", TILEDB_WRITE);

// Add members
group.addMember("array1", false, "array1Name");
group.addMember("array2", false, "array2Name");
group.addMember("array3", false, "array3Name");

// Remove members
group.removeMember("array2");
group.removeMember("array3Name");

// Reopen group in READ mode
group.reopen(ctx, QueryType.TILEDB_READ);
long members = group.getMemberCount();

Get Members

// Get the URI of a member of a group by name
String uri = group.getMemberByName("array")

Last updated