Skip to main content

Module query_analysis

Module query_analysis 

Source
Expand description

Compact query analysis facts.

This module intentionally builds on the existing parser, scope builder, type annotator, and lineage implementation. It is a convenience API: callers that need the full AST or full lineage graph should continue using those lower level APIs directly.

Structs§

AnalyzeQueryOptions
Options for analyze_query.
ColumnReferenceFact
Compact fact about an upstream column reference.
ColumnUseFact
One containing expression, with references in occurrence order. Paths are deterministic within an analysis, not persistent IDs across SQL edits.
ColumnUseReferenceFact
One resolved dependency of an original column occurrence. Several terminal dependencies can share a span (for example, a reference to a computed CTE column). Spans identify the use, not the upstream column’s definition.
CteFact
Compact fact about one top-level CTE definition.
ProjectionFact
Compact fact about one output projection.
QueryAnalysis
Compact facts about a query’s output shape and data dependencies.
QuerySourceSpan
A half-open range in the original SQL, measured in Unicode characters.
RelationFact
Compact fact about a relation visible in the root scope.
SetOperationBranchFact
Compact facts for one immediate set-operation branch.
SetOperationFact
Compact fact about a set operation.
StarProjectionFact
Compact fact about one original star projection.
TransformFunctionFact
Compact fact about a function-like projection transform.

Enums§

ColumnUseContext
The syntactic role of a column-containing expression.
ProjectionNullability
Conservative nullability classification for one output projection.
QueryShape
Top-level query shape.
ReferenceConfidence
Confidence level for a compact upstream column reference.
SetOperationBranchRole
Semantic contribution of one set-operation branch.
TransformKind
High-level kind of transformation performed by a projection.

Functions§

analyze_query
Analyze a single SELECT or set-operation query.