1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Column-level SQL lineage extraction for `dbmcp`.
//!
//! Given a single SQL statement and a `sqlparser`
//! [`Dialect`](sqlparser::dialect::Dialect),
//! [`extract`] returns a [`Lineage`] mapping each output column to the physical
//! `table.column` sources that produced it. Read queries and write statements
//! (`INSERT`, `UPDATE`, `DELETE`, `CREATE TABLE AS SELECT`, `MERGE`) are both
//! handled; writes also record a [`Lineage::target`]. Resolution is fail-closed:
//! any column that cannot be bound to a concrete source aborts the whole
//! extraction. The crate never connects to or executes against a database — it
//! analyzes SQL text only.
//!
//! Wildcards over base tables (`SELECT *`) and unqualified columns in
//! multi-table joins cannot be resolved without a column catalog, so they fail
//! closed; qualified references, single-table queries, and wildcards over
//! CTEs/derived tables resolve normally.
//!
//! # Quickstart
//!
//! ```
//! use dbmcp_sql_lineage::extract;
//! use sqlparser::dialect::PostgreSqlDialect;
//!
//! let lineage = extract("SELECT u.id, u.email FROM users u", &PostgreSqlDialect {})?;
//! assert_eq!(lineage.columns[1].name.as_deref(), Some("email"));
//! # Ok::<(), dbmcp_sql_lineage::LineageError>(())
//! ```
pub use crateLineageError;
pub use crateextract;
pub use crate;