I am trying to find a way to call stored proc with parameters -sp
using sqlAlchmey
. I found lots of answers non that solved my specific problem. As far as I understand we can always pass parameters to the sqlAlchemy
text by first formatting the string using python . But from what I have read, that is unsafe due to sqlinjection
attacks . But I am unable to find a reliable way to pas parameters with out exposing it via text.
Can some one advice me what to do or where to look for any particular module I overlooked. Or perhaps my understanding is wrong or not enough. I am not sure where to look. Any advice is helpful. Thank you.
One way I tried is like this, which I think is unsafe?
Var1= 'CALL SP('%s');'%somevalfrom somwhere
Var2=sqlalchem.text(var1)
engine execute(var2)