6

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.

lispmachine
  • 4,407
  • 1
  • 22
  • 31
KeyboardInterrupt
  • 3,483
  • 8
  • 36
  • 41

3 Answers3

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:

If you want to use something else:

Community
  • 1
  • 1
Sasha Chedygov
  • 127,549
  • 26
  • 102
  • 115
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