clokep / django-querysetsequence

Chain multiple (disparate) QuerySets in Django
https://django-querysetsequence.readthedocs.io/
ISC License
107 stars 25 forks source link

DJ1.10: TypeError: not_impl() got an unexpected keyword argument 'using' #27

Closed jpic closed 7 years ago

jpic commented 7 years ago

26 Doing just QuerySetSequence(Group.objects.all()) in the manage.py shell of dal's test_project works great with Django 1.8 and 1.9:

[dal_env] 04/04 2017 17:40:32 jpic@lue ~/env/src/dal/test_project  (fix_tests)
$ ../.tox/base-py27-django19-sqlite/bin/python manage.py shell
In [1]: from django.contrib.auth.models import Group
In [2]: from queryset_sequence import QuerySetSequence
In [3]: QuerySetSequence(Group.objects.all())
Out[3]: (0.001) SELECT COUNT(*) AS "__count" FROM "auth_group"; args=()
(0.000) SELECT "auth_group"."id", "auth_group"."name" FROM "auth_group" LIMIT 21; args=()
[]

But starting Django 1.10, it doesn't work for me anymore, I really wonder how tests make it to pass ....

[dal_env] 04/04 2017 17:38:30 jpic@lue ~/env/src/dal/test_project  (fix_tests)
$ ../.tox/base-py27-django110-sqlite/bin/python manage.py shell
In [1]: from queryset_sequence import QuerySetSequence

In [2]: from django.contrib.auth.models import Group

In [3]: QuerySetSequence(Group.objects.all())
Out[3]: ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
    670                 type_pprinters=self.type_printers,
    671                 deferred_pprinters=self.deferred_printers)
--> 672             printer.pretty(obj)
    673             printer.flush()
    674             return stream.getvalue()

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
    381                             if callable(meth):
    382                                 return meth(obj, self, cycle)
--> 383             return _default_pprint(obj, self, cycle)
    384         finally:
    385             self.end_group()

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
    501     if _safe_getattr(klass, '__repr__', None) not in _baseclass_reprs:
    502         # A user-provided repr. Find newlines and replace them with p.break_()
--> 503         _repr_pprint(obj, p, cycle)
    504         return
    505     p.begin_group(1, '<')

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _repr_pprint(obj, p, cycle)
    699     """A pprint that just redirects to the normal repr function."""
    700     # Find newlines and replace them with p.break_()
--> 701     output = repr(obj)
    702     for idx,output_line in enumerate(output.splitlines()):
    703         if idx:

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/django/db/models/query.py in __repr__(self)
    225 
    226     def __repr__(self):
--> 227         data = list(self[:REPR_OUTPUT_SIZE + 1])
    228         if len(data) > REPR_OUTPUT_SIZE:
    229             data[-1] = "...(remaining elements truncated)..."

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/django/db/models/query.py in __iter__(self)
    249                - Responsible for turning the rows into model objects.
    250         """
--> 251         self._fetch_all()
    252         return iter(self._result_cache)
    253 

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/django/db/models/query.py in _fetch_all(self)
   1101     def _fetch_all(self):
   1102         if self._result_cache is None:
-> 1103             self._result_cache = list(self._iterable_class(self))
   1104         if self._prefetch_related_lookups and not self._prefetch_done:
   1105             self._prefetch_related_objects()

/home/jpic/env/src/dal/.tox/base-py27-django110-sqlite/lib/python2.7/site-packages/django/db/models/query.py in __iter__(self)
     48         queryset = self.queryset
     49         db = queryset.db
---> 50         compiler = queryset.query.get_compiler(using=db)
     51 
     52         # Execute the query. This will also fill compiler.select, klass_info,

TypeError: not_impl() got an unexpected keyword argument 'using'
In [4]:                          
clokep commented 7 years ago

This is fixed in https://github.com/percipient/django-querysetsequence/pull/26/commits/997edc7e2f07f690f3806a6b9f4a057148c2535d, which isn't merged yet. I can split that out to a separate PR if it would help you.

jpic commented 7 years ago

You rock, no worries, I'll just use a fork until you release it.

Best regards, see you next time stuff blow up hahahahaha

clokep commented 7 years ago

👍

clokep commented 7 years ago

This will be fixed in 0.7.2. See #28.