Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django-like abstract database API for non-Django projects

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.

like image 317
KeyboardInterrupt Avatar asked Jun 01 '09 00:06

KeyboardInterrupt


3 Answers

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:

  • What are some good Python ORM solutions?
like image 80
Sasha Chedygov Avatar answered Nov 07 '22 05:11

Sasha Chedygov


Popular stand-alone ORMs for Python:

  • SQLAlchemy
  • SQLObject
  • Storm

They all support MySQL and PostgreSQL (among others).

like image 6
Ayman Hourieh Avatar answered Nov 07 '22 03:11

Ayman Hourieh


I especially like SQLAlchemy with following tools:

  • Elixir (declarative syntax)
  • Migrate (schema migration)

They really remind me of ActiveRecord.

like image 2
lispmachine Avatar answered Nov 07 '22 03:11

lispmachine