Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

stored procedures with sqlAlchemy

How can I call stored procedures of sql server with sqlAlchemy?

like image 843
AKM Avatar asked Aug 25 '10 07:08

AKM


People also ask

Is SQLAlchemy good for ETL?

One of the key aspects of any data science workflow is the sourcing, cleaning, and storing of raw data in a form that can be used upstream. This process is commonly referred to as “Extract-Transform-Load,” or ETL for short.

Is SQLAlchemy worth using?

SQLAlchemy is the ORM of choice for working with relational databases in python. The reason why SQLAlchemy is so popular is because it is very simple to implement, helps you develop your code quicker and doesn't require knowledge of SQL to get started.

What does SQLAlchemy Create_engine do?

The create_engine() method of sqlalchemy library takes in the connection URL and returns a sqlalchemy engine that references both a Dialect and a Pool, which together interpret the DBAPI's module functions as well as the behavior of the database.

Should I use SQLAlchemy core or ORM?

If you want to view your data in a more schema-centric view (as used in SQL), use Core. If you have data for which business objects are not needed, use Core. If you view your data as business objects, use ORM. If you are building a quick prototype, use ORM.


1 Answers

Engines and Connections have an execute() method you can use for arbitrary sql statements, and so do Sessions. For example:

results = sess.execute('myproc ?, ?', [param1, param2]) 

You can use outparam() to create output parameters if you need to (or for bind parameters use bindparam() with the isoutparam=True option)

like image 128
Steven Avatar answered Sep 19 '22 11:09

Steven