vertica / VerticaPy

VerticaPy is a Python library that exposes sci-kit like functionality to conduct data science projects on data stored in Vertica, thus taking advantage Vertica’s speed and built-in analytics and machine learning capabilities.
https://www.vertica.com/python/
Apache License 2.0
219 stars 45 forks source link

unable to load PMML model because call_string in undefined. #443

Closed meatcomputer closed 1 year ago

meatcomputer commented 1 year ago

flerp= vp.learn.tools.load_model("POSTPAID_CHURN_v2.POSTPAID_CHURN_v2")

QueryError Traceback (most recent call last)

in ----> 1 flerp= vp.learn.tools.load_model("POSTPAID_CHURN_v2.POSTPAID_CHURN_v2") /usr/local/csapps/csjupyter/venv/jupyterhub/lib64/python3.6/site-packages/verticapy/learn/tools.py in load_model(name, input_relation, test_relation) 340 + "', attr_name = 'call_string')", 341 method="fetchfirstelem", --> 342 print_time_sql=False, 343 ).replace("\n", " ") 344 if "SELECT " in info: /usr/local/csapps/csjupyter/venv/jupyterhub/lib64/python3.6/site-packages/verticapy/toolbox.py in executeSQL(query, title, data, method, path, print_time_sql) 219 cursor.copy(query, fs) 220 else: --> 221 cursor.execute(query) 222 elapsed_time = time.time() - start_time 223 if verticapy.options["time_on"] and print_time_sql: /usr/local/csapps/csjupyter/venv/jupyterhub/lib64/python3.6/site-packages/vertica_python/vertica/cursor.py in execute(self, operation, parameters, use_prepared_statements, copy_stdin, buffer_size) 236 if parameters: 237 operation = self.format_operation_with_parameters(operation, parameters) --> 238 self._execute_simple_query(operation) 239 240 return self /usr/local/csapps/csjupyter/venv/jupyterhub/lib64/python3.6/site-packages/vertica_python/vertica/cursor.py in _execute_simple_query(self, query) 656 self._message = self.connection.read_message() 657 if isinstance(self._message, messages.ErrorResponse): --> 658 raise errors.QueryError.from_error_response(self._message, query) 659 elif isinstance(self._message, messages.RowDescription): 660 self.description = [Column(fd) for fd in self._message.fields] QueryError: Severity: ERROR, Message: Error calling getReturnType() in User Function get_model_attribute at [src/Common/JsonUtil.cpp:176], error code: 0, message: Cannot find attribute: [call_string]. Run get_model_attribute(USING PARAMETERS model_name='model-name') without the attr_name parameter to get a list of all (case-sensitive) model attributes., Sqlstate: VP001, Routine: getReturnType, File: /data/jenkins/workspace/RE-ReleaseBuilds/RE-Jackhammer/server/vertica/Catalog/LanguageSupport.cpp, Line: 579, Error Code: 5861, SQL: "SELECT GET_MODEL_ATTRIBUTE (USING PARAMETERS model_name = 'POSTPAID_CHURN_v2.POSTPAID_CHURN_v2', attr_name = 'call_string')"
meatcomputer commented 1 year ago

looks like this loops over a standard list of model attributes and prints them all, however the PMML model we imported didn't define call string on creation, and it's not clear from the vertica documentation that there is a method for editing model attributes to work around this. we are currently on Vertica 11, and will be moving to 12 soon.

oualib commented 1 year ago

Hi @meatcomputer, load_model does not support PMML yet. This functionality is only available in SQL for the moment.

oualib commented 1 year ago

We will soon implement it, for any follow up we will use the following issue: https://github.com/vertica/VerticaPy/issues/347