how to create an API with multiple parameters?
I need an API endpoint with many parameters (like start_date, end_date, order_by ...), I know DSS can support SQL query with a dataset stored on MySQL or another DBMS, but I need to compute and process more than what MySQL function does, can I use the MySQL connection from the Python function endpoint? with some python library, thank for your help
Best Answer
-
Hi @manhnam91
,From what you are describing, it appears that you are trying to create a Python function endpoint to be deployed on your API node to interact with the dataset sored on MySQL, correct? Unfortunately, it is currently not possible to use the "Dataset" APIs in an API node endpoint as the API node is an isolated environment and thus not connected to the Design node. Therefore, API node Python will not be able to interact with datasets from the Design (or Automation) node.
However, suppose this function will always be using a particular dataset. In that case, you may be able to reference the source SQL data or "bundle" the data, in which this data or table from the underlying SQL database could then be used by the API node directly:
https://doc.dataiku.com/dss/latest/apinode/enrich-prediction-queries.html#bundled-data
Hopefully this helps, although let me know if I've misunderstood the question.
Best Regards,
Vitaliy
Answers
-
manhnam91 Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 11 Partner
many thanks for your support, I will try to implement the API with a SQL database, accessible from the API node