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
Expand Up @@ -6,6 +6,7 @@
* Fix double-offset bug in chunked sparse CSV row indices by @kounelisagis in https://github.com/TileDB-Inc/TileDB-Py/pull/2279

## Improvements
* Wrap `data_protocol` API by @kounelisagis in https://github.com/TileDB-Inc/TileDB-Py/pull/2287
* Expose overwrite parameter for saving a profile by @kounelisagis in https://github.com/TileDB-Inc/TileDB-Py/pull/2277
* Add label index support for aggregation by @kounelisagis in https://github.com/TileDB-Inc/TileDB-Py/pull/2272
* Expose the fill value setter at the Python layer by @kounelisagis in https://github.com/TileDB-Inc/TileDB-Py/pull/2274
Expand Down
12 changes: 12 additions & 0 deletions tiledb/ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,18 @@ def get_stats(self, print_out: bool = True, json: bool = False):
else:
return output

def data_protocol(self, uri: str):
"""Returns the data protocol version for the given URI.

:param uri: URI to check for data protocol version
:return: DataProtocol enum value (DATA_PROTOCOL_V2 or DATA_PROTOCOL_V3)
:rtype: tiledb.DataProtocol

For TileDB Cloud URIs (tiledb://), returns either v2 (legacy) or v3 (TileDB 3.0+).
For non-TileDB URIs (S3, Azure, GCS, etc.), returns v2.
"""
return super().data_protocol(uri)


class CtxMixin:
"""
Expand Down
7 changes: 6 additions & 1 deletion tiledb/libtiledb/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ void init_context(py::module& m) {
.def("config", &Context::config)
.def("set_tag", &Context::set_tag)
.def("get_stats", &Context::stats)
.def("is_supported_fs", &Context::is_supported_fs);
.def("is_supported_fs", &Context::is_supported_fs)
#if TILEDB_VERSION_MAJOR >= 3 || \
(TILEDB_VERSION_MAJOR == 2 && TILEDB_VERSION_MINOR >= 30)
.def("data_protocol", &Context::data_protocol)
#endif
;
}

void init_config(py::module& m) {
Expand Down
7 changes: 7 additions & 0 deletions tiledb/libtiledb/enum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ void init_enums(py::module& m) {
py::enum_<tiledb_current_domain_type_t>(m, "CurrentDomainType")
.value("NDRECTANGLE", TILEDB_NDRECTANGLE);
#endif

#if TILEDB_VERSION_MAJOR >= 3 || \
(TILEDB_VERSION_MAJOR == 2 && TILEDB_VERSION_MINOR >= 30)
py::enum_<tiledb::Context::DataProtocol>(m, "DataProtocol")
.value("DATA_PROTOCOL_V2", tiledb::Context::DataProtocol::v2)
.value("DATA_PROTOCOL_V3", tiledb::Context::DataProtocol::v3);
#endif
// test helpers to check enum name against typed value
m.def("_enum_string", &tiledb::impl::type_to_str);
m.def(
Expand Down
Loading