Skip to content

Commit b59923c

Browse files
committed
Make code conditional
1 parent 3012003 commit b59923c

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

tiledb/libtiledb/profile.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ void init_profile(py::module& m) {
3939

4040
.def("_get_param", &tiledb::Profile::get_param, py::arg("param"))
4141

42+
#if TILEDB_VERSION_MAJOR > 2 || \
43+
(TILEDB_VERSION_MAJOR == 2 && TILEDB_VERSION_MINOR >= 30)
4244
.def("_save", &tiledb::Profile::save, py::arg("overwrite"))
45+
#else
46+
.def("_save", &tiledb::Profile::save)
47+
#endif
4348

4449
.def_static(
4550
"_load",

tiledb/profile.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,14 @@ def save(self, overwrite: bool = False):
8080
:param overwrite: Whether to overwrite an existing profile. Defaults to False.
8181
:raises tiledb.TileDBError:
8282
"""
83-
self._save(overwrite)
83+
if lt.version() >= (2, 30):
84+
self._save(overwrite)
85+
else:
86+
if overwrite:
87+
raise lt.TileDBError(
88+
"The 'overwrite' parameter is only supported in TileDB 2.30.0 and later"
89+
)
90+
self._save()
8491

8592
@classmethod
8693
def load(cls, name: str = None, dir: str = None) -> "Profile":

tiledb/tests/test_profile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ def test_profile_save_load_remove(self):
101101
# remove the profile
102102
tiledb.Profile.remove("profile2_name", self.path("profile2_dir"))
103103

104+
@pytest.mark.skipif(
105+
lt.version() < (2, 30),
106+
reason="Overwrite parameter is only available in TileDB 2.30.0 and later",
107+
)
104108
def test_profile_save_overwrite(self):
105109
token1 = "testing_the_token_1"
106110
token2 = "testing_the_token_2"

0 commit comments

Comments
 (0)