Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home Software sqlalchemy What is SQLAlchemy ...

What is SQLAlchemy ...

and why should i use it.

Short: SQLAlchemy is the Database Tookit for python. 

It handles all the SQL Stuff in a very pythonic way. Starting from the very basics like database connections and queries to complete Object Mapping. SQLAlchemy can handle it all.

Connections

Connect to nearly anything with a pyhon driver. SQLite, Mysql, PostgreSQL, Oracle. Your choice. If you don't use any database specific features, it is possible to switch the backend at any time.

Connection Pooling is available and helps to reduce the connection overhead.

SQL Queries

Of course you know everything about SQL and just want to write your Queries. You can do this and i wrote these notes exactly because i need to do this. We will miss a lot of the advantages SQLAlchemy brings (seamless pythonic integration, throw away all those string operations to build a query, ...). But for those small glue scripts or the first step of transfering existing code to python it is always good to know how to talk to the database on the level below Objects.

Object Mapping

Tired of thinking in a SQL centric way? Handle everything as an object. Once coded you can just tell the object to save itself or find a related object.(Heard of hibernate? Similiar, but a lot less intrusive). If you design your application from the core, you might want to start at this end of SQLALchemy.  The SQLAlchemy Documentation focuses on this use case. The nice tutorials should cover all your needs.