Skip to content

Commit e123eb7

Browse files
committed
Generalize usage of properties for new APIs
1 parent f65714e commit e123eb7

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

dataikuapi/dss/dataset.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,22 +459,22 @@ def get_object_discussions(self):
459459
def test_and_detect(self, infer_storage_types=False):
460460
settings = self.get_settings()
461461

462-
if settings.get_type() in self.__class__.FS_TYPES:
462+
if settings.type in self.__class__.FS_TYPES:
463463
future_resp = self.client._perform_json("POST",
464464
"/projects/%s/datasets/%s/actions/testAndDetectSettings/fsLike"% (self.project_key, self.dataset_name),
465465
body = {"detectPossibleFormats" : True, "inferStorageTypes" : infer_storage_types })
466466

467467
return DSSFuture(self.client, future_resp.get('jobId', None), future_resp)
468-
elif settings.get_type() in self.__class__.SQL_TYPES:
468+
elif settings.type in self.__class__.SQL_TYPES:
469469
return self.client._perform_json("POST",
470470
"/projects/%s/datasets/%s/actions/testAndDetectSettings/externalSQL"% (self.project_key, self.dataset_name))
471471
else:
472-
raise ValueError("don't know how to test/detect on dataset type:%s" % settings.get_type())
472+
raise ValueError("don't know how to test/detect on dataset type:%s" % settings.type)
473473

474474
def autodetect_settings(self, infer_storage_types=False):
475475
settings = self.get_settings()
476476

477-
if settings.get_type() in self.__class__.FS_TYPES:
477+
if settings.type in self.__class__.FS_TYPES:
478478
future = self.test_and_detect(infer_storage_types)
479479
result = future.wait_for_result()
480480

@@ -487,7 +487,7 @@ def autodetect_settings(self, infer_storage_types=False):
487487

488488
return settings
489489

490-
elif settings.get_type() in self.__class__.SQL_TYPES:
490+
elif settings.type in self.__class__.SQL_TYPES:
491491
result = self.test_and_detect()
492492

493493
if not "schemaDetection" in result:
@@ -497,7 +497,7 @@ def autodetect_settings(self, infer_storage_types=False):
497497
return settings
498498

499499
else:
500-
raise ValueError("don't know how to test/detect on dataset type:%s" % settings.get_type())
500+
raise ValueError("don't know how to test/detect on dataset type:%s" % settings.type)
501501

502502
def get_as_core_dataset(self):
503503
import dataiku
@@ -543,7 +543,8 @@ def get_raw_params(self):
543543
"""Get the type-specific params, as a raw dict"""
544544
return self.settings["params"]
545545

546-
def get_type(self):
546+
@property
547+
def type(self):
547548
return self.settings["type"]
548549

549550
def remove_partitioning(self):

0 commit comments

Comments
 (0)