nl2sql

SchemaRetrieverNode

Overview


Responsibilities


Position in Execution Graph

Upstream:

Downstream:

Trigger conditions:

flowchart LR
    SchemaRetriever[SchemaRetrieverNode] --> Planner[ASTPlannerNode]

Inputs

From SubgraphExecutionState:

From NL2SQLContext:

Validation performed:


Outputs

Mutations to SubgraphExecutionState:

Side effects:


Internal Flow (Step-by-Step)

  1. Build semantic query with _build_semantic_query().
  2. Retrieve table/metric chunks via retrieve_schema_context().
  3. If no table chunks, retrieve columns via retrieve_column_candidates().
  4. If tables are identified, retrieve columns/relationships via retrieve_planning_context().
  5. Resolve schema snapshot via _resolve_snapshot().
  6. Build Table objects with _build_tables_from_snapshot().
  7. If no tables were found, return full snapshot with warning.
  8. On exception, log error and return empty relevant_tables.

Contracts & Interfaces

Implements a LangGraph node callable:

def __call__(self, state: SubgraphExecutionState) -> Dict[str, Any]

Key contracts:


Determinism Guarantees


Error Handling


Retry + Idempotency


Performance Characteristics


Observability


Configuration


Extension Points


Known Limitations