From e3d6731e12fb661b75ee65b0bf8040ba981b5718 Mon Sep 17 00:00:00 2001 From: Agisilaos Kounelis Date: Tue, 9 Dec 2025 11:52:24 -0500 Subject: [PATCH 1/3] Wrap `data_protocol` API --- tiledb/ctx.py | 12 ++++++++++++ tiledb/libtiledb/context.cc | 7 ++++++- tiledb/libtiledb/enum.cc | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tiledb/ctx.py b/tiledb/ctx.py index 3a9e94ed9a..a99e27a78b 100644 --- a/tiledb/ctx.py +++ b/tiledb/ctx.py @@ -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 REST 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: """ diff --git a/tiledb/libtiledb/context.cc b/tiledb/libtiledb/context.cc index 754f8154af..88c2b7e34f 100644 --- a/tiledb/libtiledb/context.cc +++ b/tiledb/libtiledb/context.cc @@ -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) { diff --git a/tiledb/libtiledb/enum.cc b/tiledb/libtiledb/enum.cc index a450ad0573..bed09a6492 100644 --- a/tiledb/libtiledb/enum.cc +++ b/tiledb/libtiledb/enum.cc @@ -182,6 +182,13 @@ void init_enums(py::module& m) { py::enum_(m, "CurrentDomainType") .value("NDRECTANGLE", TILEDB_NDRECTANGLE); #endif + +#if TILEDB_VERSION_MAJOR >= 3 || \ + (TILEDB_VERSION_MAJOR == 2 && TILEDB_VERSION_MINOR >= 30) + py::enum_(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( From 4d2e2aef85dbadffc02f39077386c597e4e9dfae Mon Sep 17 00:00:00 2001 From: Agisilaos Kounelis Date: Tue, 9 Dec 2025 12:06:36 -0500 Subject: [PATCH 2/3] Update history --- HISTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/HISTORY.md b/HISTORY.md index 0740e4efd9..e304eb36c4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 From 37336db032be44c2a7c92609a492143e016539f3 Mon Sep 17 00:00:00 2001 From: Agisilaos Kounelis <36283973+kounelisagis@users.noreply.github.com> Date: Tue, 9 Dec 2025 12:35:47 -0500 Subject: [PATCH 3/3] Update tiledb/ctx.py Co-authored-by: Ypatia Tsavliri --- tiledb/ctx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiledb/ctx.py b/tiledb/ctx.py index a99e27a78b..5e0c7c55c4 100644 --- a/tiledb/ctx.py +++ b/tiledb/ctx.py @@ -453,7 +453,7 @@ def get_stats(self, print_out: bool = True, json: bool = False): return output def data_protocol(self, uri: str): - """Returns the REST data protocol version for the given URI. + """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)