Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on August 28, 2023 7:26PM
Likes: 0
Replies: 2
Hi All:
In the past I was able to run a sotred procedure on PostgreSQL using this executor from Dataiku:
from dataiku import SQLExecutor2
the call to the stored procedure looked like this and it was completely successful:
executor = SQLExecutor2(connection=connection)
df = executor.query_to_df(stored_proc_query)
I am trying to do the same on MS SQL and the
executor.query_to_df( 'EXEC stored_procedure_name '2023-08-01'; )
does not work the same. Have you tried this before? Have you guys experienced this before?
Thanks,
Dario
Operating system used: linux AWS
Thanks for the suggestion. Reason we are using it within a Python recipe is the call to execute the stored procedure has dynamic parameters. We call the stored procedure from MS SQL using a different argument every time.
I've managed to fix the issues. The Python recipe is executing the stored procedure using
'EXEC stored_procedure_name '2023-08-01';
and we got the required results.
Thanks very much.
BTW: On PostgreSQL we use 'Call'. On MS SQL we use 'EXEC'.
HI @darioromero
,
Can you please try using "CALL" instead of "EXEC" here? We typically recommend running your procedures in SQL notebooks or SQL script recipes, just consider this documentation if you decide to call procedures inside SQL recipes.
Thanks,
Jordan