2,095 questions
4
votes
1
answer
102
views
How to aggregate hierarchical data efficiently in Django without causing N+1 queries?
I’m working with a hierarchical model structure in Django, where each level can represent a region, district, or village. The structure looks like this:
class Location(models.Model):
name = models....
1
vote
1
answer
104
views
Build the JSON Hierarchy structure using raw response
I am struggling to build the JSON hierarchy structure from the raw response JSON which I am getting from other API.
I want to generate a hierarchy structure from raw JSON Response on the basis of ...
-2
votes
2
answers
160
views
Query to find all members of multi level many to many relationships and also the top most member of the hierarchy
Multiple student can go to 1 teacher, but 1 student can't go to multiple teacher. There is no limit of level in this teacher student hierarchy.
How using a single SQL query in SQL Server we can get ...
2
votes
5
answers
95
views
Dropping grouped rows based on a certain hierarchical column
Suppose I have this pandas dataset:
ID
Question Code
1
Q01
1
Q01-1
1
Q02
2
Q01
2
Q02
2
Q02-1
2
Q02-1-1
2
Q02-2
I want to remove the rows based on certain hierarchical conditions between the values of ...
1
vote
1
answer
83
views
fixed-effect model matrix is rank deficient so dropping 5 columns / coefficients (lme4 package) after grouping age into four categories
This question appears to be a duplicate, I am however unable to resolve my case by looking at the existing suggestions on my model. I am trying to fit the three-level random intercept model. The idea ...
0
votes
0
answers
69
views
Creating Node-Specific Tree Diagrams with Pyvis or Alternative Libraries?
I am working on generating hierarchical graphs using Pyvis. In my case, the nodes are not all connected to each other, so I would like to implement a dropdown menu that allows selecting a node by name....
1
vote
1
answer
29
views
MySQL Recursive CTE to retrieve all Attached Nodes of a Table
I have a recursive structure with the following two tables:
tree represents a hierarchy of nodes where the top node has parent = NULL.
the items can be attached to any of the tree nodes, anywhere in ...
0
votes
3
answers
71
views
Transpose Hierarchical Table based on leaf nodes with roots as first column
This is similar to this one here. The difference is I want to display the roots in the first column (to the left)
I have a hierarchical table categories as follows:
id
name
parent_id
1
Accommodation
...
1
vote
3
answers
101
views
Oracle SQL hierarchical query data accumulation
I need to accumulate data in hierarchical query like this:
select
id,
prior id as parent_id,
count * prior count --need to be accumulated through whole hierarchy like sys_connect_by_path
from ...
0
votes
1
answer
361
views
How to make hierarchical view with nested child views in Swiftui
How to make this using Swiftui:
I tried to make this design in swiftui and it is resembling as well but i don't think this approach is a cleaner way. I am attaching my code below.
struct NewShapeView:...
0
votes
1
answer
72
views
Map table to exactly one of three
I have the following tables (taken out of a larger schema). It worked well for the intitial purpose (i.e., optionally map only the parent category to the wallets_balance_history table).
Now, there is ...
0
votes
1
answer
46
views
Extrapolating self-referencing keys from a hierarchy column
I'm working with a dataset in MySQL that includes a hierarchy column with formats like:
1
1.A
1.A.1
1.A.1.a
1.A.1.b
1.A.2
1.A.2.a
1.B.1
1.B.1.a
2
2.A
...
I'd like to build a table with a self-...
0
votes
1
answer
450
views
Complex BigQuery recursive CTE use case that joins on non-unique key and also unions at the same time
I have a complex (but highly interesting!) use case for BigQuery recursive CTE. I understand how to solve it conceptually but after hours of trying, I just can't get my head around exactly how to do ...
4
votes
1
answer
154
views
Bottom-up tree structure cumulative sum
CREATE TABLE Emissions (
entityId VARCHAR(512),
parentId VARCHAR(512),
emission DECIMAL,
percentContribution VARCHAR(512)
);
INSERT INTO Emissions (entityId, parentId, ...
0
votes
0
answers
54
views
SQL for hierarchical cumulative sum, but with cumulative sum of child node modified before used to calculate parent's cumsum
entityId
parentId
percentContribution
emission
emission_locationbased
emission_marketbased
cumsum_locationbased
cumsum_marketbased
E1
60
30
60
70
E2
E1
80
20
30
40
E3
E2
80
10
20
10
20
This is a ...
0
votes
1
answer
67
views
Oracle help using Connect By Root to return assembly top level parent
I'm trying to use CONNECT BY ROOT to do a recursive query that returns the top-level parent of an assembly part. My query so far is only able to return the parent one level above. I created a test ...
0
votes
0
answers
35
views
How to connect 20 same kind of tables in PowerBI?
I have excel workbook containing budget data on yearly basis. The budget is divided into certain categories and these categories are following a hierarchy. The columns of the sheets are as follows.
...
0
votes
2
answers
143
views
Mysql 8 recursive query with two mandatory parents
I am working with a hierarchy problem where the nodes have two parents and need get only the nodes where both parents are in the result.
In the happy world, this query would be perfect
WITH RECURSIVE ...
1
vote
0
answers
66
views
Display hierarchical relation on Excel or Power Bi
I'm trying to find a way to sort a hierarchy in Power Bi or Excel.
I would like to find a way to keep the (visual) structure in order. Keep the nesting between each parent and each child.
Here is the ...
1
vote
1
answer
95
views
Idiomatic approach to query hierarchical of heterogeneous data
Edit:
Maybe my problem is much more simple than I initially thought. My problem is in fact how to query complex objects (with nested objects) in relational databases. Maybe I just need to query each ...
2
votes
0
answers
117
views
AG Grid: In a treeList, can you hide (filter) all children yet still show the parent?
AG Grid: In a treeList, can you hide (filter) all children yet still show the parent?
Background: We have this problem:
We are using AG Grid's tree data model. As demonstratable on the documentation ...
2
votes
1
answer
60
views
Assistance to fix query to identify recursive relationships in data in SQL DW
I have a table which has hierarchical relationships.
My input data is
product_identifier parent_product_identifier Zone
------------------ ------------------------- ----
1 5 ...
1
vote
1
answer
317
views
AG Grid: Can a hierarchical table with instantiated parents be flattened?
Use case
Illustrated below: A hierarchical table is two levels deep (“parents” and “children”). In some instances, our users need the hierarchy to flatten, so that the children are shown as equal to ...
0
votes
1
answer
38
views
Create Leg Column in Hierarchical Data
I'm trying to add a column in my Select statement that can assign the leg number to the three legs I have. The leg number is always assigned at Level 1 in no particular order.
Note: my actual data is ...
0
votes
1
answer
126
views
Need help flattening a multi-array item in Cosmos
I'm still somewhat inexperienced with Cosmos. I have a multi-array item that I need to flatten. What we have are multiple Project items with a variable number of Resources. Each Resource also has a ...