0

I have a stored procedure defined escalate which taking a string parameter clientid.

I'm using sqlalchemy in python and using ORM. I have db.session created.

I'm not sure how i could call stored procedure with this session.

Anyone could point me the solution?

I have tried following; but getting an error:

TypeError: get_bind() got an unexpected keyword argument 'param'

Code:

from sqlalchemy import and_, func,text

db.session.execute(text("CALL escalate(:param)"), param=clientid)
marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
Ratha
  • 8,920
  • 16
  • 71
  • 141

1 Answers1

1

From the docs session.execute needs a dict over kwargs, unlike the connection object which should have worked as you wrote it.

db.session.execute(
    "CALL escalate(:param)",
    {'param': clientid}
)
Kirk
  • 1,589
  • 15
  • 19
  • do you know why i face this error?https://stackoverflow.com/questions/58987744/why-the-stored-procedure-called-from-sqlalchemy-is-not-working-but-calling-from They way i call storedprocedure is right or wrong? – Ratha Nov 22 '19 at 05:05