Skip to main content

Module extractor

Module extractor 

Source
Expand description

Extraction APIs at three granularities of “what does this SQL touch?”

Each sub-extractor is a thin wrapper around the bound-plan analysis engine, projecting the resolved plan into a different surface:

Each extractor returns Vec<Result<X, Error>> so one statement that fails to extract doesn’t sink the rest of a multi-statement string. (A parse error fails the whole call — the outer Result — since statements can’t be separated before parsing.) Sub-modules are private; the public items reach users through the wildcard re-exports below.

Structs§

ColumnLineageEdge
A column-level lineage edge: data from source contributes to target. Emitted for both relation-target statements (INSERT / UPDATE / MERGE / CTAS / CREATE VIEW, target = ColumnTarget::Relation) and bare SELECT (target = ColumnTarget::QueryOutput).
ColumnOperation
Column-level operations performed by a single SQL statement.
ColumnOperationExtractor
Struct-style entry point. Equivalent to the free extract_column_operations function.
CrudTableExtractor
Struct-style entry point. Equivalent to the free extract_crud_tables function. A thin shim over TableOperationExtractor that buckets reads/writes into the CRUD positions, consulting the bind’s normalized MERGE clause summary (rather than re-walking the raw AST) for the one verb-aware case — whose target placement depends on the WHEN actions.
CrudTables
Per-statement output of extract_crud_tables: tables bucketed by CRUD position plus non-fatal diagnostics. Display renders "Create: [...], Read: [...], Update: [...], Delete: [...]".
ExtractorOptions
Optional inputs shared by every *_with_options extractor. Defaults to no catalog and the dialect-derived identifier casing — i.e. the plain extract_*(dialect, sql) behaviour.
TableLineageEdge
A source-to-target table lineage edge inferred from the statement structure.
TableOperation
Operations performed by a single SQL statement.
TableOperationExtractor
Struct-style entry point. Equivalent to the free extract_table_operations function.

Enums§

ColumnLineageKind
How a source column contributes to its target — the one clean, exclusive distinction: is the value forwarded unchanged, or derived?
ColumnTarget
The target endpoint of a ColumnLineageEdge — a column in a named relation (Relation) or a transient SELECT output (QueryOutput).
StatementKind
What a statement does, at a coarse level. The verb of the statement — INSERT vs CREATE TABLE vs MERGE vs … — combined with the reads / writes split recovers every distinction the project needs to make at table granularity. Shared by every extractor (each surfaces it as statement_kind).

Functions§

extract_column_operations
Convenience function to extract column-level operations from SQL using the dialect defaults (no catalog, dialect-derived casing). For a catalog or a casing override, use extract_column_operations_with_options; with a catalog, table references are matched against it (right-anchored, dialect-cased) and column resolution turns strict.
extract_column_operations_with_options
Like extract_column_operations but with ExtractorOptions — a catalog and/or an identifier-casing override. dialect still drives parsing; the options govern only the analysis.
extract_crud_tables
Parse sql under dialect and return one CrudTables per statement.
extract_crud_tables_with_options
Like extract_crud_tables but with ExtractorOptions — a catalog and/or an identifier-casing override. With a catalog, the bucketed tables are canonicalized to their registered path.
extract_table_operations
Convenience function to extract table-level operations from SQL using the dialect defaults (no catalog, dialect-derived casing). For a catalog or a casing override, use extract_table_operations_with_options.
extract_table_operations_with_options
Like extract_table_operations but with ExtractorOptions — a catalog and/or an identifier-casing override. dialect still drives parsing; the options govern only the analysis.