nl2sql

DatasourceResolverNode

Overview


Responsibilities


Position in Execution Graph

Upstream:

Downstream:

Trigger conditions:

flowchart LR
    Resolver[DatasourceResolverNode] --> Decomposer[DecomposerNode]

Inputs

From GraphState:

Context dependencies (NL2SQLContext):

Validation performed:


Outputs

Mutations to GraphState:

Side effects:


Internal Flow (Step-by-Step)

  1. If state.datasource_id is set, validate that it exists in the registry.
  2. If override is valid, check RBAC access; return error on violation.
  3. If no override and vector_store is missing, return empty response with reasoning.
  4. Retrieve datasource candidates with VectorStore.retrieve_datasource_candidates().
  5. Convert candidate documents into ResolvedDatasource entries.
  6. Filter to allowed datasources using RBAC.
  7. Apply schema version mismatch policy (fail or warn).
  8. Return DatasourceResolverResponse with resolved, allowed, and unsupported IDs.
  9. On exceptions, log and return SCHEMA_RETRIEVAL_FAILED error.

Contracts & Interfaces

Implements a LangGraph node callable:

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

Key contracts:


Determinism Guarantees


Error Handling

Emits PipelineError with:

Exceptions are caught at the node boundary and logged with logger.error.


Retry + Idempotency


Performance Characteristics


Observability


Configuration


Extension Points


Known Limitations