django user (using django ORM) + SQLAlchemy for other db tables

510 views
Skip to first unread message

Dennis

unread,
Sep 10, 2013, 12:34:48 PM9/10/13
to django...@googlegroups.com
Any advice (or potential problems) with using SQLAlchemy with the django framework but keeping the django user auth module?

The django ORM would be used for the auth module (and its user table).
SQLAlchemy ORM would be used for other tables and also to read (but not write) the django user table.

This combination would allow the power of SQLAlchemy but maintain compatibility with django auth -- a sweet combination!
Of course, the django admin system would likely not work, but that's ok.

I thought this combination would work without being too much of a headache.
But when I posted this on the SQLAlchemy google group for advice, the response was negative: they do not recommend using this combination:
https://groups.google.com/forum/#!topic/sqlalchemy/VlR2At_mUcE

But the django experts are on the django mailing list, so I thought I would ask this group too.
Just wondering if others have tried this combination and what issues might have come up.
From my google searching, the 2 references below (and their references) are really the only mention of this approach on the web!
So, it would be great to get some definitive advice on this seemly reasonable approach.

This approach is described in the stackoverflow comment here:
http://stackoverflow.com/questions/18465197/how-do-i-start-with-django-orm-to-easily-switch-to-sqlalchemy#comment27166795_18476898

The method to integrate SQLAlchemy into django is described here:
http://stackoverflow.com/questions/6606725/best-way-to-integrate-sqlalchemy-into-a-django-project



Avraham Serour

unread,
Sep 10, 2013, 1:30:12 PM9/10/13
to django...@googlegroups.com
why?


--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Dennis

unread,
Sep 10, 2013, 1:37:43 PM9/10/13
to django...@googlegroups.com
This combination would allow the power of SQLAlchemy but maintain compatibility with django auth -- a sweet combination!


Avraham Serour

unread,
Sep 10, 2013, 3:31:20 PM9/10/13
to django...@googlegroups.com
from what I understand SQLAlchemy is an ORM, which django already have, I would assume you need something specific in the "power" that django's ORM doesn't have.

so again I question why? what exactly do you need in SQLAlchemy? also what's so special about django auth? you could easily create your own custom auth relying on SQLAlchemy.

also in a crazy case that one would like to use SQLAlchemy inside django just because he is more familiar with for example it is not necessarily mutually exclusive, you could create the models with django and map in SQLAlchemy to query, or vice versa.


Philip Goh

unread,
Mar 12, 2014, 12:29:24 PM3/12/14
to django...@googlegroups.com


On Tuesday, 10 September 2013 20:31:20 UTC+1, Avraham Serour wrote:
so again I question why? what exactly do you need in SQLAlchemy? also what's so special about django auth? you could easily create your own custom auth relying on SQLAlchemy.

I'm in a similar situation as I have an app where the non-web portions use SQLAlchemy and we're intending to write the web interface in Django. It seems a little silly to duplicate the model layer in Django too.


- Phil 

Mathieu Rodic

unread,
Feb 5, 2015, 8:48:31 AM2/5/15
to django...@googlegroups.com
I have been working on a Django project, where complex queries were required... so the Django ORM was out of question.

As I didn't want to have both Django and SQLAlchemy models hanging around, I chose to use aldjemy.

You can use this simple tutorial to set it up on your Django app!
Reply all
Reply to author
Forward
0 new messages