SQL ALchemy support on django

492 views
Skip to first unread message

Asif Saifuddin

unread,
Sep 16, 2015, 4:35:15 AM9/16/15
to Django developers (Contributions to Django itself)
Hi,


How much difficult it will be to add SQLalchemy support to django? what are the technical difficulties? And which are the ways to add sqlalchemy support to django?

As SQLalchemy is separated in core and orm will it be wise to use sqlalchemy core as the backend for django orm? Or  through the meta api? any suggestion or direction to the solutions?

The available 3rd party packages seems to be incomplete.


Regards

Asif

Russell Keith-Magee

unread,
Sep 16, 2015, 7:21:05 PM9/16/15
to Django Developers
Hi Asif,

It depends entirely what you mean by "support".

Django is just Python, so there's absolutely no reason you can't write
a Django site that uses Django for the URLs, views and forms, but
SQLAlchemy for the data access.

Out of the box, you won't be able to use ModelForms or the Admin.
However, with the new stable Meta API that was added in 1.8, you
should be able to write a layer for SQLAlchemy that makes a SQLAlchemy
table definition "quack" like a Django model, allowing you to wrap.

Daniel Parathion did this as a proof of concept as part of his GSoC
project using the Gmail API - he was able to expose a Gmail inbox as a
Django model, browse his inbox in Admin, and use a ModelForm to
compose an email from within the admin.

I gave a presentation at the recent DjangoCon US about this topic; the
slides are available here:

https://speakerdeck.com/freakboy3742/i-never-meta-model-i-didnt-like

Video should be available in the next week or so. Short version: it
won't be *trivial*, but it's certainly *possible*, although you're in
undocumented territory, so you'll have to navigate the sharp edges
yourself.

Yours,
Russ Magee %-)
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-develop...@googlegroups.com.
> To post to this group, send email to django-d...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/33078771-6802-44f9-9182-1eb2f7104e23%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Asif Saifuddin

unread,
Sep 17, 2015, 12:00:26 AM9/17/15
to django-d...@googlegroups.com
Hi,

With "support" I meant having a official djangoish way to use sqlalchemy on django. As I have to use model meta API to add support for any non django backend to orm my question is, is django meta API fully formalized? If not how much work is needed to formalize them?(as denial did a lots of work then their should be proper guideline or enough insight to start digging? ) 

Or we are ok with the existing API's?

Regards

Asif

You received this message because you are subscribed to a topic in the Google Groups "Django developers  (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/puVGMV7GlNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.

To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.

Anssi Kääriäinen

unread,
Sep 17, 2015, 12:53:34 AM9/17/15
to django-d...@googlegroups.com
The meta API used by admin and model forms should be completely public
and stable. The problem is that some methods of the meta API return
field instances, and the API for the fields (especially for related
fields) isn't public nor stable. You'll need to somehow return field
instance that act like Django's.

- Anssi
> https://groups.google.com/d/msgid/django-developers/CAKAqTgrgsSz6OEWQXt5LzLVOCybsLyV1yZJV%3DrPBbVHu6D9xKA%40mail.gmail.com.

Asif Saifuddin

unread,
Nov 3, 2015, 11:17:32 AM11/3/15
to Django developers (Contributions to Django itself)
I would like to create an experiemental repo on my github for experiementing the sqla support to django orm, hence some useful resource indicator would be great. sqla have core engine and orm on top of it, so the idea way to start experiment should be based on core?

Marcin Nowak

unread,
Nov 4, 2015, 7:30:45 PM11/4/15
to Django developers (Contributions to Django itself)


On Tuesday, November 3, 2015 at 5:17:32 PM UTC+1, Asif Saifuddin wrote:
I would like to create an experiemental repo on my github for experiementing the sqla support to django orm, hence some useful resource indicator would be great. sqla have core engine and orm on top of it, so the idea way to start experiment should be based on core?


I would like to contribute. But I'm afraid about all things dependent on DjangoORM, like migrations,admin,(model) forms and so on.
I like Django, most of it`s features and simplicity, but not DB layer (incl. migrations), html-related forms nor system checks.

There are several ways I think:
  • fork of Django (a new project based on good things), with some compatibility layer
  • brand new framework based on great Werkzeug and SqlAlchemy, with good-things picked from Django
  • switching to Flask (there is SqlAlchemy ext)
The last is the simplest :)

Cheers,
Marcin

Asif Saifuddin

unread,
Nov 4, 2015, 11:17:28 PM11/4/15
to django-d...@googlegroups.com
Hei,

I tried several frameworks, but django is my favorite for many reason. I have some familarities with django internal code and mechanism.  sqlalchemy integration with django is a challenging task as dj admin and forms and some other thinks need to be figure out. 

Cheers
Asif

--
You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/puVGMV7GlNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.

Russell Keith-Magee

unread,
Nov 5, 2015, 1:03:49 AM11/5/15
to Django Developers

Hi Asif,

On Wed, Nov 4, 2015 at 12:17 AM, Asif Saifuddin <auv...@gmail.com> wrote:
I would like to create an experiemental repo on my github for experiementing the sqla support to django orm, hence some useful resource indicator would be great. sqla have core engine and orm on top of it, so the idea way to start experiment should be based on core?
 
I gave a broad description of what this would look like in my DjangoCon US presentation:


The answer is to write an adaptor for SQLAlchemy so that it can “quack” like Django’s Meta model, which will then make it compatible with Django’s Admin and Forms.

Yours,
Russ Magee %-)


Asif Saifuddin

unread,
Nov 5, 2015, 1:12:30 AM11/5/15
to django-d...@googlegroups.com
that's an awsome link :)

thanks russ.

--
You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/puVGMV7GlNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.

Asif Saifuddin

unread,
Mar 4, 2016, 3:00:11 AM3/4/16
to Django developers (Contributions to Django itself)
Hi,

I will be working on preparing a proposal for sql-alchemy support on django. [thorugh model meta]. 

Thanks


On Wednesday, September 16, 2015 at 2:35:15 PM UTC+6, Asif Saifuddin wrote:

Asif Saifuddin

unread,
May 30, 2016, 9:42:50 AM5/30/16
to Django developers (Contributions to Django itself)
Hi,

I failed to apply for gsoc, but I planned to give some effort on this whenever I get some time. Anyone having interest and time could help he with some tecnical guidence. Much more to do there. 

Thanks

Reply all
Reply to author
Forward
0 new messages