Notes on integrating GraphAlchemy with web frameworks


There are a few different options for using Flask with SQLAlchemy, which you can read about on Flask’s docs.

Using Flask-SQLAlchemy plugin

The only real caveat is that if you want to use Flask-SQLAlchemy, you should use the :func`~graphalchemy.sqlmodels.create_flask_classes` function, and pass it an SQLAlchemy instance (usually called db).

Pyramid (prev Pylons)

Pyramid has a cookbook entry on using SQLAlchemy with Pyramid. But it’s basically just normal use of SQLAlchemy, with a few specific notes on using Pyramid’s DBSession for sessions and some advanced topics that aren’t really relevant here.


webapp2 should work without a problem, just import it and use it like you would with SQLAlchemy (probably just use it straight up?)

Incompatible frameworks (for now)

Google App Engine

Google App Engine doesn’t have a (standard) relational database, but a future version of graphalchemy will have a version that works with App Engine (though it may or may not be a really efficient solution).


Django uses its own ORM (which you can replace with SQLAlchemy, but it means you lose much of Django’s functionality). There may be a future version of graphalchemy that will support Django, but for the moment, you’d have to choose to use SQLAlchemy.