django-nonrel / djangotoolbox

Django tools for building nonrel backends
BSD 3-Clause "New" or "Revised" License
200 stars 125 forks source link

django 1.8 compatibility in the db module #64

Closed kavdev closed 8 years ago

kavdev commented 9 years ago

It'd also be great if this was released to PyPI. The version on there is still behind.

kavdev commented 9 years ago

So, django.db.models.query.iterator now fetches an initial query via compiler.execute_sql(). Since iterator is not overridden in djangotoolbox, a select request now gets sent to the base compiler which has historically only expected count queries. Ideally, select logic should be in the base compiler's execute_sql() method, but this is not the case. In the new flow, that initial query sent to execute_sql() returns None and results_iter is called to handle the query as usual.

results_iter now has a results parameter which defaults to None. If it's None, the query is evaluated. In django 1.8's compiler code, that parameter is part of some kind of caching mechanism that I didn't look into.

aburgel commented 9 years ago

with this patch, do any of the nonrel db backends support 1.8?

kavdev commented 9 years ago

Are you asking whether or not other nonrel backends will automatically work because of this patch?

That depends on how much they've overwritten. Most of the changes are in the execute_sql methods of each compiler.

Here's a quick list of changes/compatibility guide:

Public API

Private API

aburgel commented 9 years ago

Thanks for the explanation. I'm mostly curious because these changes can't be used unless you've also got the corresponding changes to the backends. Are you also working on those? For which backends?

kavdev commented 8 years ago

I mean I'd assume the maintainers would update their packages if updating this dependency. If this is a no go, I'll just create a 1.8+ fork.

aburgel commented 8 years ago

Not a no-go. This is definitely good stuff. Just curious how you're planning to use it.

kavdev commented 8 years ago

Ah, gotcha. I maintain django-ewiz, which uses djangotoolbox as a template.