SelectoComponents.SubselectBuilder (selecto_components v0.4.5)

Builds subselect queries for denormalizing columns to prevent row multiplication. Converts one-to-many and many-to-many relationships into JSON aggregations.

Link to this section Summary

Functions

Builds SQL for subselects with proper correlation

Builds a Selecto query with subselects for denormalizing columns.

Formats subselect results for proper JSON aggregation

Generates configuration for nested table display

Merges subselect results with main query results

Optimizes subselects for performance

Separates columns into main query columns and subselect groups

Validates that subselects are properly configured

Link to this section Functions

Link to this function

add_subselect_for_group(selecto, relationship_path, columns)

Link to this function

build_subselect_sql(base_table, relationship, columns, correlation_key)

Builds SQL for subselects with proper correlation

Link to this function

build_with_subselects(selecto, normal_columns, denormalizing_groups)

Builds a Selecto query with subselects for denormalizing columns.

Takes a base selecto, normal columns, and denormalizing groups, returns an enhanced selecto with subselects.

Link to this function

format_subselect_results(results, subselect_config)

Formats subselect results for proper JSON aggregation

Link to this function

generate_nested_config(relationship_path, columns)

Generates configuration for nested table display

Link to this function

merge_results(main_results, subselect_results)

Merges subselect results with main query results

Link to this function

optimize_subselects(selecto, subselect_configs)

Optimizes subselects for performance

Link to this function

separate_columns(selecto, all_columns, prevent_denormalization \\ true)

Separates columns into main query columns and subselect groups

Link to this function

validate_subselects(selecto)

Validates that subselects are properly configured