2

In SQLAlchemy, what is the preferred way to call a stored database procedure? (including set arguments and receive exit status and outputted variables)

I've seen some examples that use execute() to execute a raw database string, but this could contain vendor specific syntax, right?

1 Answer 1

5

Yes you can use execute and it can indeed contain vendor specific syntax.

You should also consider using outparam.

From SQLAlchemy Docs :

sqlalchemy.sql.expression.outparam(key, type_=None) Create an ‘OUT’ parameter for usage in functions (stored procedures), for databases which support them.

The outparam can be used like a regular function parameter. The “output” value will be available from the ResultProxy object via its out_parameters attribute, which returns a dictionary containing the values.

Here are some examples of using outparam: http://nullege.com/codes/search/sqlalchemy.sql.outparam

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.