Skip to content

Commit 57d3916

Browse files
committed
nicer interfaces to the run function/query endpoints
1 parent f2420a8 commit 57d3916

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

dataikuapi/apinode_client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ def predict_records(self, endpoint_id, records, forced_generation=None, dispatch
6767

6868
return self._perform_json("POST", "%s/predict-multi" % endpoint_id, body = obj)
6969

70+
def evaluate_function(self, endpoint_id, **kwargs):
71+
"""
72+
Applies a DSS API node function endpoint (Python or R) to the given parameters
73+
74+
:param str endpoint_id: Identifier of the endpoint to query
75+
:param **kwargs: parameters to the functon
76+
77+
:return: a Python dict of the API answer. The answer is the result
78+
"""
79+
return self.apply_on_record(endpoint_id, kwargs)
80+
7081
def apply_on_record(self, endpoint_id, features):
7182
"""
7283
Applies a function on a single record on a DSS API node endpoint (Python or R function)
@@ -78,6 +89,17 @@ def apply_on_record(self, endpoint_id, features):
7889
"""
7990
return self._perform_json("POST", "%s/run" % endpoint_id, body = features)
8091

92+
def run_query(self, endpoint_id, **kwargs):
93+
"""
94+
Run a DSS API node SQL endpoint with the given parameters
95+
96+
:param str endpoint_id: Identifier of the endpoint to query
97+
:param **kwargs: parameters to the functon
98+
99+
:return: a Python dict of the API answer. The answer is the a dict with a columns field and a rows field (list of rows as list of strings)
100+
"""
101+
return self.query_on_record(endpoint_id, kwargs)
102+
81103
def query_on_record(self, endpoint_id, features):
82104
"""
83105
Run a record on a DSS API node SQL endpoint

0 commit comments

Comments
 (0)