0

I have a python script which gives me a result by taking inputs.

And I have a mysql database. Now I want to execute the python script from mysql procedure or function!!

Is it possible to do it ?? If yes , please help me in achieving this task or suggest me some resources from which I can acomplish this task.

Thank you in advance.

4
  • The only way I can think of doing this is with a User Defined Function, which is an executable object file that you link into the MySQL server. But they run in the server process, not the client, so it won't be able to get input from the user. Commented Jun 27, 2014 at 11:24
  • actually y do want to call it from mysql. what is scenario. so that we can help you better Commented Jun 27, 2014 at 11:26
  • See dev.mysql.com/doc/refman/5.1/en/adding-functions.html for details about UDF. Commented Jun 27, 2014 at 11:28
  • @sundar nataraj Сундар I have python script(which is fairly complex) for calculating XIRR() value , but I'm not able to replicate the same function in mysql so I want to make use of the existing XIRR() python script in mysql.... Commented Jun 27, 2014 at 11:34

1 Answer 1

1

Requiring user input is obviously an interactive process which neither should nor can run on a server. From your question I gather you want actually do your computations using the user input and some data from your server. This doesn't require to run your code from the server. Instead extend your python script to render a UI for your user, use the MySQL python connector to connect your python script to your MySQL server and get the data you need. After that do your calculations and preset the result to the user.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.