Skip to content

Commit

Permalink
Use SOMAContext in SparseNDArray
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv committed Feb 23, 2024
1 parent 0ec160a commit e60bb37
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions apis/python/src/tiledbsoma/_sparse_nd_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ def read(
self._check_open_read()
_util.check_unpartitioned(partitions)

config = handle.config().copy()
config.update(platform_config or {})
context = handle.context()
if platform_config is not None:
config = context.tiledb_config.copy()
config.update(platform_config or {})
context = clib.SOMAContext(config)

ts = None
if handle.timestamp is not None:
Expand All @@ -171,7 +174,7 @@ def read(
sr = clib.SOMASparseNDArray.open(
uri=handle.uri,
mode=clib.OpenMode.read,
platform_config=config,
context=context,
column_names=[],
result_order=_util.to_clib_result_order(result_order),
timestamp=ts,
Expand Down
2 changes: 2 additions & 0 deletions apis/python/src/tiledbsoma/_tdb_handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def open(
return DataFrameWrapper._from_soma_object(soma_object, context)
elif open_mode == clib.OpenMode.read and obj_type == "SOMADenseNDArray":
return DenseNDArrayWrapper._from_soma_object(soma_object, context)
elif open_mode == clib.OpenMode.read and obj_type == "SOMASparseNDArray":
return SparseNDArrayWrapper._from_soma_object(soma_object, context)

if obj_type in (
"SOMADataFrame",
Expand Down
2 changes: 1 addition & 1 deletion apis/python/src/tiledbsoma/_tiledb_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TileDBObject(somacore.SOMAObject, Generic[_WrapperType_co]):
"""Class variable of the Wrapper class used to open this object type."""
_wrapper_type: Type[_WrapperType_co]
_reader_wrapper_type: Union[
Type[_WrapperType_co], Type[_tdb_handles.DataFrameWrapper]
Type[_WrapperType_co], Type[_tdb_handles.SOMAArrayWrapper]
]

__slots__ = ("_close_stack", "_handle")
Expand Down
2 changes: 1 addition & 1 deletion apis/python/src/tiledbsoma/soma_sparse_ndarray.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void load_soma_sparse_ndarray(py::module &m) {
std::optional<std::pair<uint64_t, uint64_t>>>(&SOMASparseNDArray::open),
"uri"_a,
"mode"_a,
"ctx"_a,
"context"_a,
py::kw_only(),
"column_names"_a = py::none(),
"result_order"_a = ResultOrder::automatic,
Expand Down

0 comments on commit e60bb37

Please sign in to comment.