-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When using the --database-info as a children data source, the following "tree" is constructed programatically in a hard-coded way:
ds_statistics_creator/create_aux_temp_tables.sql
Lines 63 to 100 in a87763a
| -- insert level 0 | |
| insert into tree | |
| SELECT handle, id, name, cant, CONCAT('.', id,'.'), CONCAT('.', handle,'.'), depth | |
| FROM cant_per_com cp | |
| WHERE depth = 0; | |
| -- insert level 1 | |
| insert into tree | |
| SELECT cp.handle, cp.id, cp.name, cp.cant, CONCAT(t.uuid_path, cp.id, '.'), CONCAT(t.path, cp.handle, '.'), cp.depth | |
| --SELECT handle, name, CONCAT(handle), cant, depth | |
| FROM cant_per_com cp | |
| INNER JOIN tree t on cp.handle_padre = t.handle | |
| WHERE cp.depth = 1 -- and cp.handle = '10915/41' | |
| ORDER BY cp.handle_padre, cp.handle; | |
| -- insert level 2 | |
| insert into tree | |
| SELECT cp.handle, cp.id, cp.name, cp.cant, CONCAT(t.uuid_path, cp.id, '.'), CONCAT(t.path, cp.handle, '.'), cp.depth | |
| FROM cant_per_com cp | |
| INNER JOIN tree t on cp.handle_padre = t.handle | |
| WHERE cp.depth = 2 | |
| ORDER BY cp.handle_padre, cp.handle; | |
| -- insert level 3 | |
| insert into tree | |
| SELECT cp.handle, cp.id, cp.name, cp.cant, CONCAT(t.uuid_path, cp.id, '.'), CONCAT(t.path, cp.handle, '.'), cp.depth | |
| FROM cant_per_com cp | |
| INNER JOIN tree t on cp.handle_padre = t.handle | |
| WHERE cp.depth = 3 | |
| ORDER BY cp.handle_padre, cp.handle; | |
| -- insert level 4 | |
| insert into tree | |
| SELECT cp.handle, cp.id, cp.name, cp.cant, CONCAT(t.uuid_path, cp.id, '.'), CONCAT(t.path, cp.handle, '.'), cp.depth | |
| FROM cant_per_com cp | |
| INNER JOIN tree t on cp.handle_padre = t.handle | |
| WHERE cp.depth = 4 | |
| ORDER BY cp.handle_padre, cp.handle; |
Try to get the max depth stored in this table
| CREATE TEMPORARY TABLE cant_per_com AS ( |
and generate the auxiliar "tree" based on this calculated depth.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels