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:
extract_crud_tables— tables bucketed by CRUD verb (Create / Read / Update / Delete).extract_table_operations— per-statementTableOperationwithreads/writes/lineageat table granularity.extract_column_operations— same shape at column granularity, plus per-column lineage kinds (Passthrough / Transformation).
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§
- Column
Lineage Edge - A column-level lineage edge: data from
sourcecontributes totarget. Emitted for both relation-target statements (INSERT / UPDATE / MERGE / CTAS / CREATE VIEW, target =ColumnTarget::Relation) and bare SELECT (target =ColumnTarget::QueryOutput). - Column
Operation - Column-level operations performed by a single SQL statement.
- Column
Operation Extractor - Struct-style entry point. Equivalent to the free
extract_column_operationsfunction. - Crud
Table Extractor - Struct-style entry point. Equivalent to the free
extract_crud_tablesfunction. A thin shim overTableOperationExtractorthat bucketsreads/writesinto 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. - Crud
Tables - Per-statement output of
extract_crud_tables: tables bucketed by CRUD position plus non-fatal diagnostics.Displayrenders"Create: [...], Read: [...], Update: [...], Delete: [...]". - Extractor
Options - Optional inputs shared by every
*_with_optionsextractor. Defaults to no catalog and the dialect-derived identifier casing — i.e. the plainextract_*(dialect, sql)behaviour. - Table
Lineage Edge - A source-to-target table lineage edge inferred from the statement structure.
- Table
Operation - Operations performed by a single SQL statement.
- Table
Operation Extractor - Struct-style entry point. Equivalent to the free
extract_table_operationsfunction.
Enums§
- Column
Lineage Kind - How a source column contributes to its target — the one clean, exclusive distinction: is the value forwarded unchanged, or derived?
- Column
Target - The target endpoint of a
ColumnLineageEdge— a column in a named relation (Relation) or a transient SELECT output (QueryOutput). - Statement
Kind - What a statement does, at a coarse level. The verb of the statement
— INSERT vs CREATE TABLE vs MERGE vs … — combined with the
reads/writessplit recovers every distinction the project needs to make at table granularity. Shared by every extractor (each surfaces it asstatement_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_operationsbut withExtractorOptions— a catalog and/or an identifier-casing override.dialectstill drives parsing; the options govern only the analysis. - extract_
crud_ tables - Parse
sqlunderdialectand return oneCrudTablesper statement. - extract_
crud_ tables_ with_ options - Like
extract_crud_tablesbut withExtractorOptions— 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_operationsbut withExtractorOptions— a catalog and/or an identifier-casing override.dialectstill drives parsing; the options govern only the analysis.