Tuesday, December 24, 2013

Re: Django ORM & DB backend coupling

On Tue, Dec 24, 2013 at 4:15 PM, Rakan Alhneiti
<rakan.alhneiti@gmail.com> wrote:
> Hello all,
>
> I was discussing the topic with a couple of my friends that Django's ORM is
> / is not tightly coupled with databases in general. My point of view was
> that django is not tightly coupled because you can write custom DB backends
> to deal with other sources of data such as a Restful API service while still
> taking advantage of the ORM.
> However, looking at the current architecture & implementation, i guess i can
> say that it is coupled because writing a custom backend would require you to
> write database-specific classes such as the DatabaseWrapper, Operations,
> Features .. etc.
>
> Is wiring Django's ORM with a Restful API service rather than MySQL or
> Postgresql a good idea? or the better one would be writing ORMs from scratch
> that are API-based rather than database-driven?

I actually ended up implementing a "REST ORM" from scratch, but
heavily inspired by Django's ORM. I managed to spend a couple of weeks
on it, but now the project is dead. You may want to take a look at it
anyway:

http://confine-orm.readthedocs.org/
http://redmine.confine-project.eu/projects/confine-orm/repository

The main difference with Django is that resource schema is not
predefined, but discovered while browsing the API. Also the API for
what it was developed for did not support filtering, so it does
client-side filtering with heavy use of concurrency.

Don't really know how much you'll need to sacrifice in order to fit a
REST service within a Django ORM backend. It could be fun to do it,
but leveraging all its potential seems quite difficult at first look,
I would say it's not worth the trouble :)

--
Marc

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BDCN_s3pb_%3D07vTb96qZANjBb30UZKnt7hB-fmhPuCD8PZxXg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment