dimagi / django-cte

Common Table Expressions (CTE) for Django
Other
334 stars 46 forks source link

Add support django 3.0 #10

Closed auvipy closed 4 years ago

jnns commented 4 years ago

I tried to find a solution for this but had to give up as I'm not familiar enough with the ORM. These are my findings:

Since https://github.com/django/django/commit/24b82cd201e21060fbc02117dc16d1702877a1f3#diff-0edd853580d56db07e4020728d59e193 Query._annotations is available as Query.annotations.

The bigger issue comes with https://github.com/django/django/commit/35431298226165986ad07e91f9d3aca721ff38ec#diff-0edd853580d56db07e4020728d59e193: tests involving a subquery fail because the selected columns don't use the subquery alias anymore but instead refer to the parent table.

warmwaffles commented 4 years ago

This is preventing us from upgrading to 3.0. Anyone make any progress on this?

ryanhiebert commented 4 years ago

@jnns: If we're willing to just use .annotations, despite the overhead that it can sometimes have due to making an OrderedDict, it looks like that's been available since Django 1.8: https://github.com/django/django/commit/f59fd15c4928caf3dfcbd50f6ab47be409a43b01. That seems like the most reasonable course of action there.

I'll make a PR to do that, and then see if I can figure out the other one in reasonable time, although I also am not terribly familiar with the ORM. Thank you for the work you put into it.

ryanhiebert commented 4 years ago

I haven't been able to make any further progress on this. If someone comes across this, please feel free to take a whack at it. I think it's just 2 tests failing now, but it's doing an incorrect reference for annotated columns, and I haven't fully unpacked why and exactly what is going on.

ryanhiebert commented 4 years ago

@millerdev : My employer, AspirEDU, is interested in funding the work to get this library working with Django 3.0. Is that something that you'd be willing to discuss? Is so, please send me an email at ryan@aspiredu.com, so we can get that conversation going.

ryanhiebert commented 4 years ago

@millerdev: It won't be possible for us to work through dimagi for this work, because of the minimum contract amount. Might you be willing to work with us directly? If so, would you mind reaching out with a non-Dimagi account, as the contact you pointed me to requested that further discussion in this direction not happen over Dimagi communication channels, such as your dimagi email.