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.
+9
A:
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:
musicfreak
2009-06-01 01:00:11
Exactly what I was looking for. Thanks!!
KeyboardInterrupt
2009-06-01 01:06:54
No problem. :)
musicfreak
2009-06-01 01:07:30
Simple, accurate, and straight to the point. Maybe add two lines on what's an ORM, for the heck of completeness? :)
NicDumZ
2009-06-01 01:39:39
Sure, why not? Done. :)
musicfreak
2009-06-01 01:41:53
+4
A:
Popular stand-alone ORMs for Python:
They all support MySQL and PostgreSQL (among others).
Ayman Hourieh
2009-06-01 01:01:55
+1: SQLAlchemy -- not quite as sexy as Django ORM, but easier to tie to an existing SQL database.
S.Lott
2009-06-01 01:54:40
+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
2009-06-01 02:45:34
A:
I especially like SQLAlchemy with following tools:
They really remind me of ActiveRecord.
lispmachine
2009-06-01 07:20:15