Django ORM Internals

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Django ORM Internals

Mahdi Xareie

Hello everyone,

I got interested in contributing to the django project recently and I noticed lots of tickets are related to the ORM, I like to contribute to the ORM and close as many tickets as I can.
I started to read ORM related tickets and also checking related pull requests, since ORM is a big package and contains lots of modules, I found it very difficult to understand the changes in the pull requests.
Do you know any good resource about the internal structure of the django ORM? a blog post perhaps, anything to help me get started on the ORM internals.



--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/c5b2efa7-e6b6-4b42-9d14-aed68b2388b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Django ORM Internals

J. Pic
Hi Mahdi,

I would suggest reading the code and test code in the tests/ directory for the ORM.

There might also be some videos from Django Under The Hood conferences, found some here:


Best

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAC6Op19dN2b_PNYgEjqLYa_aawKNWh8BnscrCs-vd7tBQmSpmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Django ORM Internals

Mahdi Xareie
Great, thanks

On Monday, May 13, 2019 at 1:17:08 PM UTC+4:30, J. Pic wrote:
Hi Mahdi,

I would suggest reading the code and test code in the tests/ directory for the ORM.

There might also be some videos from Django Under The Hood conferences, found some here:

<a href="https://www.google.com/search?q=Django+Under+The+Hood+orm&amp;tbm=vid" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/search?q\x3dDjango+Under+The+Hood+orm\x26tbm\x3dvid&#39;;return true;" onclick="this.href=&#39;https://www.google.com/search?q\x3dDjango+Under+The+Hood+orm\x26tbm\x3dvid&#39;;return true;">https://www.google.com/search?q=Django+Under+The+Hood+orm&tbm=vid

Best

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/81554698-8fad-4fd0-a534-a566725058b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Django ORM Internals

Adam Johnson-2
Yes there isn't much documented on the ORM internals, but there are other resources. The DUTH videos are a great start and inspired me to get started contributing to Django. Specifically:
This talk is also on my to-watch list, from James Bennett, he covers a lot of internals:
As for looking through the code, try looking at django.contrib.postgres first - it's interesting as it's all *extensions* to the ORM (custom fields, migration operations, etc.) so an easier on ramp than diving into the inner code of Query etc. It's what insipred me to make my library django-mysql ( https://github.com/adamchainz/django-mysql ) that does the same kind of stuff for MySQL/MariaDB.

Then maybe look itno tracing some simple queryset operations, such as Foo.objects.all(), and see all the steps that goes through. Understand what Query is and how SQLCompiler converts it to SQL that the database backend executes.

Hope that helps,

Adam

On Mon, 13 May 2019 at 09:54, Mahdi Zareie <[hidden email]> wrote:
Great, thanks

On Monday, May 13, 2019 at 1:17:08 PM UTC+4:30, J. Pic wrote:
Hi Mahdi,

I would suggest reading the code and test code in the tests/ directory for the ORM.

There might also be some videos from Django Under The Hood conferences, found some here:


Best

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/81554698-8fad-4fd0-a534-a566725058b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Adam

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM00cB5Mz%2Bsec3KpF%3DEF9Z4yXipzMwuag7q%2B5EFA8cch2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Django ORM Internals

Aymeric Augustin
Hello,

I would suggest https://www.youtube.com/watch?v=bgV39DlmZ2U if you'd like to understand how the ORM is structured in layers.

-- 
Aymeric.

Le lun. 13 mai 2019 à 12:16, Adam Johnson <[hidden email]> a écrit :
Yes there isn't much documented on the ORM internals, but there are other resources. The DUTH videos are a great start and inspired me to get started contributing to Django. Specifically:
This talk is also on my to-watch list, from James Bennett, he covers a lot of internals:
As for looking through the code, try looking at django.contrib.postgres first - it's interesting as it's all *extensions* to the ORM (custom fields, migration operations, etc.) so an easier on ramp than diving into the inner code of Query etc. It's what insipred me to make my library django-mysql ( https://github.com/adamchainz/django-mysql ) that does the same kind of stuff for MySQL/MariaDB.

Then maybe look itno tracing some simple queryset operations, such as Foo.objects.all(), and see all the steps that goes through. Understand what Query is and how SQLCompiler converts it to SQL that the database backend executes.

Hope that helps,

Adam

On Mon, 13 May 2019 at 09:54, Mahdi Zareie <[hidden email]> wrote:
Great, thanks

On Monday, May 13, 2019 at 1:17:08 PM UTC+4:30, J. Pic wrote:
Hi Mahdi,

I would suggest reading the code and test code in the tests/ directory for the ORM.

There might also be some videos from Django Under The Hood conferences, found some here:


Best

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/81554698-8fad-4fd0-a534-a566725058b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Adam

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAMyDDM00cB5Mz%2Bsec3KpF%3DEF9Z4yXipzMwuag7q%2B5EFA8cch2g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


--
Aymeric.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CANE-7mUixaF76W9MwN_y4ufvT%3D-hMq4PkuwFZVva4UafktOA9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.