Moon
Moon

Reputation: 4160

How to call postgresql stored procedure using sqlalchemy?

I have developed stored procedure in postgresql which accepting 2 parameters & I am calling it using sqlalchemy using below code but getting syntax error.

I have tried sqlalchemy online tutorials.

connection.execute('stored_proce_name ?, ?',  para_1, para_2 )                                        

Getting error like :ProgrammingError('(psycopg2.errors.SyntaxError) syntax error at or near "stored_proce_name "\nLINE 1: stored_proce_name ?, ?\n ^\n')

Upvotes: 4

Views: 538

Answers (1)

Pitto
Pitto

Reputation: 8589

Here's how I do it:

result = conn.execute(StoredProc("add", (3, 4), Integer))

Upvotes: 3

Related Questions