Giter Site home page Giter Site logo

Comments (5)

plopidou avatar plopidou commented on July 22, 2024 1

Great, many thanks to all who contributed! :)

Will this materialise in a 1.2.1 or something?

from django-cte.

millerdev avatar millerdev commented on July 22, 2024

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.

plopidou avatar plopidou commented on July 22, 2024

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 and 3 are the parents ("depth 1")
  • 4, 5 and 6 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.

millerdev avatar millerdev commented on July 22, 2024

Fixed by #60

from django-cte.

ZipBrandon avatar ZipBrandon commented on July 22, 2024

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.