django-pandas
django-pandas copied to clipboard
Possible to have read_frame work with RawQuerySet ?
When trying to use read_frame with a RawQuerySet :
from django_pandas.io import read_frame
from apps.immodata.models import Observation
obj = MyModel.objects.raw("Select * from myapp_mymodel") # dummy RawQuerySet
read_frame(obj)
getting this error :
venv/lib/python3.5/site-packages/django_pandas/io.py in read_frame(qs, fieldnames, index_col, coerce_float, verbose)
74 fieldnames = tuple(fieldnames) + (index_col,)
75 fields = to_fields(qs, fieldnames)
---> 76 elif is_values_queryset(qs):
77 if django.VERSION < (1, 9):
78 if django.VERSION < (1, 8):
venv/lib/python3.5/site-packages/django_pandas/io.py in is_values_queryset(qs)
30 return isinstance(qs, django.db.models.query.ValuesQuerySet)
31 else:
---> 32 return qs._iterable_class == django.db.models.query.ValuesIterable
33
34
AttributeError: 'RawQuerySet' object has no attribute '_iterable_class'
Is there a workaround?
Can I lnow why thos was closed without any more information ?
Sorry @stellasia we were closing a number of PRs as part of the decision not to support the versions of Django prior to 1.11 I guess this got thrown in the mix? I will revisit this one. Do you have a PR for this?
Hi @chrisdev
No I do not have a PR because actually I would not know from where to start to fix the issue. If you have any advice, I can investigate more.
And I will check the error is still there for django >= 1..11 (no guarantee I was using this version for my first post)
Thanks :)