Comments (5)
Great, many thanks to all who contributed! :)
Will this materialise in a 1.2.1 or something?
from django-cte.
This looks like an issue that may be fixed by #46. Your example may be a good starting point to create a test, which is needed before that PR can be merged.
from django-cte.
Thank you.
Just to clarify, this is a dumbed down example of what I am trying to obtain:
person table:
id | parent
1 | NULL
2 | 1
3 | 1
4 | 2
5 | 2
6 | 3
Where:
1
is the grandparent ("depth 0")2
and3
are the parents ("depth 1")4
,5
and6
are the children ("depth 2")
event table:
id | person
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
6 | 6
Ideally, I would get:
[
{id:1, event_count: 6},
{id:2, event_count: 3},
{id:3, event_count: 2},
{id:4, event_count: 1},
{id:5, event_count: 1},
{id:6, event_count: 1},
]
... which would be the aggregated count()
of all events of self
, and all children, for each Person
object.
from django-cte.
Fixed by #60
from django-cte.
@plopidou Did you get this working where you can recursively roll-up the values to the grandparent? I have only figured out how to accumulate the values to the leaves/children.
from django-cte.
Related Issues (20)
- Muliples With joins HOT 3
- Allow non-recursive CTEs to avoid optimization fence HOT 1
- Support UNION queries that share a CTE HOT 2
- Cannot install via pipenv HOT 1
- no such table: cte while importing fixtures HOT 4
- Support Django 4.0 HOT 2
- Improve documentation HOT 3
- is there a way to select from a cte without joining it with a model? HOT 5
- Usage in the context of time series HOT 1
- Combining with django-reversion HOT 2
- Can I count all children in Queryset annotate? HOT 7
- Unneccessary outer join breaks query HOT 1
- With(empty_qs) throws Error HOT 1
- “no such column”/“column does not exist” errors in Django 4.2 HOT 9
- Not able to do full outer join with django_cte HOT 2
- hnej
- `.update()` does not work when accessing nested tables HOT 1
- Minor : typo in the doc
- How to use as default manager? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-cte.