I love the abstract database API that comes with Django, I was wondering if I could use this (or something similar) to model, access, and manage my (postgres) database for my non-Django Python projects.
Asked
Active
Viewed 2,725 times
6
3 Answers
17
What you're looking for is an object-relational mapper (ORM). Django has its own, built-in.
To use Django's ORM by itself:
- Using the Django ORM as a standalone component
- Use Django ORM as standalone
- Using settings without setting DJANGO_SETTINGS_MODULE
If you want to use something else:

Community
- 1
- 1

Sasha Chedygov
- 127,549
- 26
- 102
- 115
-
Simple, accurate, and straight to the point. Maybe add two lines on what's an ORM, for the heck of completeness? :) – Nicolas Dumazet Jun 01 '09 at 01:39
6
Popular stand-alone ORMs for Python:
They all support MySQL and PostgreSQL (among others).

Ayman Hourieh
- 132,184
- 23
- 144
- 116
-
1+1: SQLAlchemy -- not quite as sexy as Django ORM, but easier to tie to an existing SQL database. – S.Lott Jun 01 '09 at 01:54
-
+1 on SQLAlchemy also. I don't see the point in using it in Django, due to the fine integration of its own ORM with its other parts. But SQLAlchemy specializes in exactly what you're looking for, and does that one thing extremely well. – ShawnMilo Jun 01 '09 at 02:45
2
I especially like SQLAlchemy with following tools:
They really remind me of ActiveRecord.

lispmachine
- 4,407
- 1
- 22
- 31