DatasourceResolverNodepackages/nl2sql/src/nl2sql/pipeline/nodes/datasource_resolver/node.pyVectorStore.retrieve_datasource_candidates().DatasourceResolverResponse in GraphState.Upstream:
Downstream:
DecomposerNode if resolution succeeds.Trigger conditions:
flowchart LR
Resolver[DatasourceResolverNode] --> Decomposer[DecomposerNode]
From GraphState:
user_query (str, required): used for vector retrieval when no override provided.datasource_id (Optional[str]): explicit override for datasource selection.user_context (UserContext, required): RBAC enforcement.Context dependencies (NL2SQLContext):
vector_store (optional): if missing, resolver returns empty response.ds_registry: adapter registry for supported IDs and capabilities.schema_store: used to look up latest schema versions.rbac: used to filter allowed datasources.Validation performed:
settings.schema_version_mismatch_policy.Mutations to GraphState:
datasource_resolver_response (DatasourceResolverResponse)errors (list of PipelineError) on failurereasoning and warnings for diagnosticsSide effects:
state.datasource_id is set, validate that it exists in the registry.vector_store is missing, return empty response with reasoning.VectorStore.retrieve_datasource_candidates().ResolvedDatasource entries.fail or warn).DatasourceResolverResponse with resolved, allowed, and unsupported IDs.SCHEMA_RETRIEVAL_FAILED error.Implements a LangGraph node callable:
def __call__(self, state: GraphState) -> Dict[str, Any]
Key contracts:
DatasourceResolverResponseResolvedDatasourcePipelineErrordatasource_id override.Emits PipelineError with:
INVALID_STATE (missing/unknown datasource override)SECURITY_VIOLATION (RBAC denial)SCHEMA_RETRIEVAL_FAILED (no candidates or exceptions)Exceptions are caught at the node boundary and logged with logger.error.
datasource_resolverGraphState for downstream diagnostics.VECTOR_BREAKER at the vector store layer.settings.schema_version_mismatch_policy (warn or fail)build_graph() to change resolution behavior._get_latest_schema_version, which is not defined in this class (would raise if executed as-is).packages/nl2sql/src/nl2sql/pipeline/nodes/datasource_resolver/node.pypackages/nl2sql/src/nl2sql/pipeline/nodes/datasource_resolver/schemas.py