Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# In Progress

## API Changes
* Permit true-ASCII attributes in non-from-pandas dataframes [#1337](https://github.com/TileDB-Inc/TileDB-Py/pull/1337)
* Addition of `Array.upgrade_version` to upgrade array to latest version [#1334](https://github.com/TileDB-Inc/TileDB-Py/pull/1334)
* Attributes in query conditions no longer need to be passed to `Array.query`'s `attr` arg [#1333](https://github.com/TileDB-Inc/TileDB-Py/pull/1333)

Expand Down
2 changes: 2 additions & 0 deletions tiledb/libtiledb.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,8 @@ cdef class Attr(object):
if isinstance(dtype, str) and dtype == "ascii":
tiledb_dtype = TILEDB_STRING_ASCII
ncells = TILEDB_VAR_NUM
if var is None:
var = True
else:
_dtype = np.dtype(dtype)
tiledb_dtype, ncells = array_type_ncells(_dtype)
Expand Down
11 changes: 10 additions & 1 deletion tiledb/tests/test_libtiledb.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,15 @@ def test_ascii_attribute(self, sparse, capfd):
dom = tiledb.Domain(
tiledb.Dim(name="d", domain=(1, 4), tile=1, dtype=np.uint32)
)
attrs = [tiledb.Attr(name="A", dtype="ascii", var=True)]

with pytest.raises(TypeError) as exc_info:
tiledb.Attr(name="A", dtype="ascii", var=False)
assert (
str(exc_info.value) == "dtype is not compatible with var-length attribute"
)

attrs = [tiledb.Attr(name="A", dtype="ascii")]

schema = tiledb.ArraySchema(domain=dom, attrs=attrs, sparse=sparse)
tiledb.Array.create(path, schema)

Expand All @@ -547,6 +555,7 @@ def test_ascii_attribute(self, sparse, capfd):
assert A.schema.nattr == 1
A.schema.dump()
assert_captured(capfd, "Type: STRING_ASCII")
assert A.schema.attr("A").isvar
assert A.schema.attr("A").dtype == np.bytes_
assert A.schema.attr("A").isascii
assert_array_equal(A[:]["A"], np.asarray(ascii_data, dtype=np.bytes_))
Expand Down