Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_array():
# The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4] and space tiles 2x2.
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))
# The array will be dense with a single attribute "a" so each (i,j) cell can store an integer.
schema = tiledb.ArraySchema(domain=dom, sparse=False,
attrs=[tiledb.Attr(name="a", dtype=np.int32)])
# Create the (empty) array on disk.
tiledb.DenseArray.create(array_name, schema)
def main():
ctx = tiledb.Ctx()
# create dimensions
d1 = tiledb.Dim(ctx, "", domain=(1, 1000), tile=10, dtype="uint64")
d2 = tiledb.Dim(ctx, "d2", domain=(101, 10000), tile=100, dtype="uint64")
# create domain
domain = tiledb.Domain(ctx, d1, d2)
# create attributes
a1 = tiledb.Attr(ctx, "", dtype="int32,int32,int32")
a2 = tiledb.Attr(ctx, "a2", compressor=("gzip", -1), dtype="float32")
# create sparse array with schema
schema = tiledb.SparseArray(ctx, "sparse_array_schema",
domain=domain, attrs=(a1, a2),
capacity=10,
tile_order='row-major',
cell_order='col-major',
coords_compressor=('zstd', 4),
offsets_compressor=('blosc-lz', 5))
schema.dump()
# Print from schema
def create_array():
ctx = tiledb.Ctx()
dom = tiledb.Domain(tiledb.Dim(name="rows", domain=(1, 4), tile=4, dtype=np.int64),
tiledb.Dim(name="cols", domain=(1, 4), tile=4, dtype=np.int64),
ctx=ctx)
attrs = [
tiledb.Attr(name="a1", var=True, dtype='U', ctx=ctx),
tiledb.Attr(name="a2", var=True, dtype=np.int64, ctx=ctx)
]
schema = tiledb.ArraySchema(domain=dom, sparse=False,
attrs=attrs,
ctx=ctx)
tiledb.Array.create(array_name, schema, ctx=ctx)
return schema
def create_array():
# The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4].
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))
# The array will be dense with a single attribute "a" so each (i,j) cell can store an integer.
schema = tiledb.ArraySchema(domain=dom, sparse=False,
attrs=[tiledb.Attr(name="a", dtype=np.int32)])
# Create the (empty) array on disk.
tiledb.DenseArray.create(array_name, schema)
def create_array():
# The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4].
dom = tiledb.Domain(tiledb.Dim(name="rows", domain=(1, 4), tile=4, dtype=np.int32),
tiledb.Dim(name="cols", domain=(1, 4), tile=4, dtype=np.int32))
# The array will be sparse with a single attribute "a" so each (i,j) cell can store an integer.
schema = tiledb.ArraySchema(domain=dom, sparse=True,
attrs=[tiledb.Attr(name="a", dtype=np.int32)])
# Create the (empty) array on disk.
tiledb.SparseArray.create(array_name, schema)
def main():
ctx = tiledb.Ctx()
# Create dimensions
d1 = tiledb.Dim(ctx, "d1", domain=(1, 4), tile=2, dtype="uint64")
d2 = tiledb.Dim(ctx, "d2", domain=(1, 4), tile=2, dtype="uint64")
# Create domain
domain = tiledb.Domain(ctx, d1, d2)
# Create attributes
a1 = tiledb.Attr(ctx, "a1", compressor=('blosc-lz', -1), dtype="int32")
a2 = tiledb.Attr(ctx, "a2", compressor=("gzip", -1), dtype="S10")
a3 = tiledb.Attr(ctx, "a3", compressor=('zstd', -1), dtype='float32,float32')
# Create sparse array
tiledb.SparseArray(ctx, "my_sparse_array",
domain=domain,
attrs=(a1, a2, a3),
capacity=2,
cell_order='row-major',
tile_order='row-major')
[tiledb.ZstdFilter(1, ctx=ctx)])
if coords_filters is None:
coords_filters = tiledb.FilterList(
[tiledb.ZstdFilter(1, ctx=ctx)])
if nrows:
if full_domain is None:
full_domain = False
# create the domain and attributes
# if sparse==None then this function may return a default based on types
dims, sparse = create_dims(ctx, dataframe, index_dims, sparse=sparse,
tile=tile, full_domain=full_domain)
domain = tiledb.Domain(
*dims,
ctx = ctx
)
attrs, attr_metadata = attrs_from_df(dataframe,
index_dims=index_dims,
filters=attrs_filters,
column_types=column_types)
# now create the ArraySchema
schema = tiledb.ArraySchema(
domain=domain,
attrs=attrs,
cell_order=cell_order,
tile_order=tile_order,
coords_filters=coords_filters,
def create_array():
# The array will be 4x4 with dimensions "rows" and "cols", with domain [1,4].
dom = tiledb.Domain(ctx,
tiledb.Dim(ctx, name="rows", domain=(0, (TEST_ARRAY.shape[0] - 1)),
tile=10000, dtype=np.int32))
# The array will be dense with a single attribute "a" so each (i,j) cell can store an integer.
schema = tiledb.ArraySchema(ctx, domain=dom, sparse=False,
attrs=[tiledb.Attr(ctx, name="a", dtype=np.float64)])
# Create the (empty) array on disk.
tiledb.DenseArray.create(tiledb_array_name, schema)