Deleting coordinates from sparse array

Hey, is there any way to delete coordinates from a sparse array?

I noticed there is a “delete” mode on the docs - is that for the entire array or can I specify a sub-array?

Asking because I get junk values when I run:

with,'r') as f:

Hi @mdylan2,

Deletes work on dimension or attribute values that match a query condition. Here’s an example:

import tiledb, numpy as np
import tempfile
from numpy.testing import assert_array_equal

path = tempfile.mkdtemp("example_sparse_coord_delete")

dom = tiledb.Domain(tiledb.Dim(name="x", domain=(1, 10), tile=1, dtype=np.uint32))
attrs = [tiledb.Attr("ints", dtype=np.uint32)]
schema = tiledb.ArraySchema(domain=dom, attrs=attrs, sparse=True)
tiledb.Array.create(path, schema)

data = np.random.randint(1, 10, 10)

qc = "x < 5"

with, "w") as A:
    A[np.arange(1, 11)] = data

with, "d") as A:

with, "r") as A:

You could similarly use "ints < 5", or other conditions on the attribute value instead.

Hope this helps,

1 Like

thank you! @ihnorton

1 Like