zimmer
zimmer

Reputation: 1207

Calling stored procedure in postgresql from sqlalchemy

I'm using sqlalchemy for python ORM , and I want to call a stored procedure which exists in postgresql. I can't find useful tutorials ,please tell me how to code.

Thank you very much

Upvotes: 2

Views: 6775

Answers (2)

RobertT
RobertT

Reputation: 4570

Using execute() on Connectionor Engine object, like:

result = conn.execute('SELECT procname(?,?)', 1, 2).fetchall()

Take a look at SQLAlchemy documentation for more info.

Upvotes: 2

Szymon Lipiński
Szymon Lipiński

Reputation: 28664

I don't know about any special classes SQLAlchemy provides for calling a procedure.

However you can always use simple select like:

SELECT * FROM proc(4,2);

Upvotes: -1

Related Questions