Index expressions

288 views
Skip to first unread message

Curtis Maloney

unread,
Feb 7, 2016, 6:11:59 AM2/7/16
to django-d...@googlegroups.com

So, in #django recently there was a discussion about adding an index on
a date field for just the year.

I know the idea was raised some time ago, and several ideas on the
syntax were expressed. But most of that focused on different types of
indices - not on indexing expressions.

It occurred to me that with the recent advances in expression syntax, it
should be fairly easy to add an indexes list to Meta to define complex
expressions.

Input?

--
C

Josh Smeaton

unread,
Feb 7, 2016, 6:26:38 AM2/7/16
to Django developers (Contributions to Django itself)
There are many places that expressions can extend to, and I think indexes would make a really good candidate. There are a few things that need to happen to make this work though.

- create meta.indexes to store { index_name: IndexType('field') }
- internally translate any db_index=True to the appropriate key: val in above meta.indexes
- internally translate index_together into meta.indexes
- use compiler to generate the sql
- ensure that migrations handle these new indexes properly

I would also suggest that index names be queried to ensure we're not trying to use existing names. Not sure if migrations already do this, but I seem to remember something about not being able to track index names. Am I totally off base?

This idea would actually make a really good GSoC (or similar..) project. Is there much interest from the community in custom indexes?

Tim Graham

unread,
Feb 8, 2016, 12:30:40 PM2/8/16
to Django developers (Contributions to Django itself)
I added "Custom indexes" to the ideas list at https://code.djangoproject.com/wiki/SummerOfCode2016. Feel free to revise the description or add yourself as a possible mentor.

Asif Saifuddin

unread,
Mar 2, 2016, 2:46:29 PM3/2/16
to Django developers (Contributions to Django itself)
Hi Josh,

I'm willing to work on django orm improvment for gsoc and considering custom index as a project idea. I have gone through the available resources like dep, POC on class based index, unification of transform API etc. What others stuff do you suggest me to look into to have some concrete ideas to complete a very good proposal.

Thanks
Asif

Tim Graham

unread,
Mar 3, 2016, 8:07:12 AM3/3/16
to Django developers (Contributions to Django itself)
FYI, I'm aware of another student working on a proposal for that project. You're welcome to develop a competing proposal, but you're at a disadvantage at this point since the other student has a track record of successful contributions.

Asif Saifuddin

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

Thanks for your early input on the issue. I don't think I should compete with any specific proposal which already have another better competitor. I did some research on  SQLalchemy backend support on django and relevant improvement long ago before class based index. I will go for a sqlalchemy support on django then. and will try to contribute on relevant field too to prove myself as a strong candidate for that proposal. do you know any one else working on SQLalchemy support? or should I proceed aboout this?

Thanks


On Sunday, February 7, 2016 at 5:11:59 PM UTC+6, Curtis Maloney wrote:

Tim Graham

unread,
Mar 3, 2016, 1:20:50 PM3/3/16
to Django developers (Contributions to Django itself)
No, I'm not aware of any ongoing work or plans to add SQLAlchemy support. Let's continue the discussion in a separate thread since this is now off topic.

aleksand...@gmail.com

unread,
Mar 21, 2016, 2:59:43 PM3/21/16
to Django developers (Contributions to Django itself)
Hello, Tim.

Is there free tasks for me, I'm a new one in django(0.5 year), but it's really interesting for me and I want to be useful for us and have a good summer with great experience.

waiting your answer and making a contribution, Alex

Tim Graham

unread,
Mar 21, 2016, 6:39:02 PM3/21/16
to Django developers (Contributions to Django itself)
Sorry, but if you haven't started a proposal yet and haven't contributed to Django before, it's unlikely you'll develop a successful proposal in less than a week (the application deadline is Friday).
Reply all
Reply to author
Forward
0 new messages