Hi Team,
We would like to invoke an external service from Singlestore StoredProcedure and exploring External Function feature but in docs it says -
“CREATE [OR REPLACE] EXTERNAL FUNCTION` is currently a private preview feature and must be enabled via a Support Request for SingleStoreDB Cloud users.”
cmd>docker exec -it singlestore-ciab memsql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 504 Server version: 5.7.32 MemSQL source distribution (compatible; MySQL Enterprise & MySQL Commercial)
Also in other environment we have - DB version is : 7.5.18
cmd>docker exec -it singlestore-ciab memsql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 504 Server version: 5.7.32 MemSQL source distribution (compatible; MySQL Enterprise & MySQL Commercial)
Also in other environment we have - DB version is : 7.5.18
Hi Prakash! Thanks for your patience. I was able to get some advice from the support team and have included it below.
Because it looks like you are looking at the SingleStoreDB Cloud docs, while running SingleStoreDB On-Premises - the team has suggested this link to our SingleStoreDB documentation.
From here you can filter for the version you are running and to get a better understanding of your environments functionality.
In this particular case with the CREATE [OR REPLACE] EXTERNAL FUNCTION for SingleStoreDB On-Premises - this feature is not available until version 7.6. The associated docs are linked here.
As this feature is unavailable in 7.5, could you please try to upgrade the environment to at least 7.6 to get access?
Looking forward to hearing this resolved your issue.
I have 7.8 version docker image install now. but I m not able to use [CREATE [OR REPLACE] EXTERNAL FUNCTION feature to call a REST API hosted outside of memsql. I created the function and when calling the function I m getting -
ERROR 2576 UNKNOWN_ERR_CODE: External function runtime failure: Couldn’t connect to server
Attached code snippet of create function and api call.
Hi arnaud,
I think the things are getting confusing for me now like what is external function vs calling HTTP rest api. Let me rephrase it please-
We have SingleStoredb-studio version 7.8 docker image db is in-primises. In this SingleStoreDB we have some stored procedures written which contains the pipeline which consume the data from a topic.
Similarly what I want is - there is a RestAPI as well which is hosted on tomcat server i.e like hosted somewhere else which takes some input and then calls to some tables and return the response. we have all the details like endpoint url token generator and all and we are like calling the API from postman.
Similarly we want to call this Rest API from singleStoreBD store procedure to fetch some data like and want to utilize RestAPI response .
For that I wrote the above code I might be wrong in understand what CREATE [OR REPLACE] EXTERNAL FUNCTION is for.
Now please let me know if this is possible form SingleStoreDB or not? Like do we need to create external function or we can directly call the API. If possible what all flag/ settings we needs to do and how to call the RestAPI (steps to call the API)
Also which version of singlestoredb-server and singlestoredb-studio support this feature.
Have you tried installing your image with that command? -e HTTP_API=ON -p 9000:9000
I think that what you have started is the correct way to use that function. I would like to see if you still get the same error message when you have added the command.
Hi arnaud
First thank you for quick response really appreciated.
I tried all like what you have been suggesting but still getting same error.
Bellow is the container command I run and have added like you suggested please check if command looks good.
To help you further, we would have to get more details in being able to repro those steps (I have tried to repo but I cannot connect to your URL and you probably don’t want to give me the credentials and configs on the forum).
Can you create a support ticket to be able to share more confidential information to repro your issue?