| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| import numpy as np |
|
|
| import tiledb |
|
|
| array_name = "fragment_info" |
|
|
|
|
| def create_array(): |
| |
| dom = tiledb.Domain( |
| tiledb.Dim(name="rows", domain=(1, 4), tile=2, dtype=np.int32), |
| tiledb.Dim(name="cols", domain=(1, 4), tile=2, dtype=np.int32), |
| ) |
|
|
| |
| schema = tiledb.ArraySchema( |
| domain=dom, sparse=False, attrs=[tiledb.Attr(name="a", dtype=np.int32)] |
| ) |
|
|
| |
| tiledb.Array.create(array_name, schema) |
|
|
|
|
| def write_array_1(): |
| with tiledb.open(array_name, mode="w") as A: |
| A[1:3, 1:5] = np.array(([[1, 2, 3, 4], [5, 6, 7, 8]])) |
|
|
|
|
| def write_array_2(): |
| with tiledb.open(array_name, mode="w") as A: |
| A[2:4, 2:4] = np.array(([[101, 102], [103, 104]])) |
|
|
|
|
| def write_array_3(): |
| with tiledb.open(array_name, mode="w") as A: |
| A[3:4, 4:5] = np.array(([202])) |
|
|
|
|
| |
| if tiledb.object_type(array_name) != "array": |
| create_array() |
| write_array_1() |
| write_array_2() |
| write_array_3() |
|
|
| |
| fragments_info = tiledb.array_fragments(array_name) |
|
|
| print("====== FRAGMENTS INFO ======") |
| print("array uri: {}".format(fragments_info.array_uri)) |
| print("number of fragments: {}".format(len(fragments_info))) |
|
|
| to_vac = fragments_info.to_vacuum |
| print("number of consolidated fragments to vacuum: {}".format(len(to_vac))) |
| print("uris of consolidated fragments to vacuum: {}".format(to_vac)) |
|
|
| print(fragments_info.nonempty_domain) |
| print(fragments_info.sparse) |
|
|
| for fragment in fragments_info: |
| print() |
| print("===== FRAGMENT NUMBER {} =====".format(fragment.num)) |
| print("fragment uri: {}".format(fragment.uri)) |
| print("is sparse: {}".format(fragment.sparse)) |
| print("cell num: {}".format(fragment.cell_num)) |
| print("has consolidated metadata: {}".format(fragment.has_consolidated_metadata)) |
| print("nonempty domain: {}".format(fragment.nonempty_domain)) |
| print("timestamp range: {}".format(fragment.timestamp_range)) |
| print( |
| "number of unconsolidated metadata: {}".format( |
| fragment.unconsolidated_metadata_num |
| ) |
| ) |
| print("version: {}".format(fragment.version)) |
|
|