Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to have read_frame work with RawQuerySet ? #101

Open
stellasia opened this issue Apr 4, 2018 · 3 comments
Open

Possible to have read_frame work with RawQuerySet ? #101

stellasia opened this issue Apr 4, 2018 · 3 comments

Comments

@stellasia
Copy link

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?

@stellasia
Copy link
Author

Can I lnow why thos was closed without any more information ?

@chrisdev
Copy link
Owner

chrisdev commented Feb 4, 2019

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?

@chrisdev chrisdev reopened this Feb 4, 2019
@stellasia
Copy link
Author

stellasia commented Feb 4, 2019

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants