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
  • 732,580
  • 175
  • 1,330
  • 1,459
Ratha
  • 9,434
  • 17
  • 85
  • 163

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,779
  • 14
  • 20
  • 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