-
Notifications
You must be signed in to change notification settings - Fork 47
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
no such table: cte while importing fixtures #39
Comments
Are you trying to do what was described in this comment (construct a query with a |
Exactly :D But the querying part do work, that's just the insertion part which is failing. The SELECT is properly generated and it works without a model in the FORM: >>> str(UserInfo.with_rank.all().query)
'WITH RECURSIVE cte AS (SELECT "issue39_userinfo"."id", "issue39_userinfo"."user_id", "issue39_userinfo"."points", DENSE_RANK() OVER (ORDER BY "issue39_userinfo"."points" DESC) AS "r" FROM "issue39_userinfo") SELECT "cte"."id", "cte"."user_id", "cte"."points", "cte"."r" AS "r" FROM "cte"' I tried with the Django model as a FORM by slighly changing my return in
I'm now having:
The query being:
Using a CTE as base_manager_name may not be a good idea :D I was just hoping to make this work:
|
Actually, this is possible. It's covered in the newly written documentation: https://dimagi.github.io/django-cte/#selecting-from-a-common-table-expression However, I'm not sure that is the real issue here. @JulienPalard Did you ever get this resolved? |
Hi! Currently an alteriative works, that I use in production: https://framagit.org/hackinscience/hkis-website/-/blob/2ad08645/hkis/models.py#L28 But the reproducer I liked in the first issue still raises the |
With the following model:
If I create some values, use
dumpdata
to save them, andloaddata
to get them back I'm getting:I'm having a small reproducer here, just run:
Or if you want to start it from scratch, it looks like:
Full stack trace
The text was updated successfully, but these errors were encountered: