Skip to main content

ModelDag

Struct ModelDag 

Source
pub struct ModelDag {
    pub graph: DiGraph<ModelNode, ()>,
    pub node_map: HashMap<String, NodeIndex>,
}
Expand description

Complete pipeline DAG with topological execution tiering and cycle detection.

Fields§

§graph: DiGraph<ModelNode, ()>§node_map: HashMap<String, NodeIndex>

Implementations§

Source§

impl ModelDag

Source

pub fn new() -> Self

Source

pub fn add_model( &mut self, name: impl Into<String>, raw_sql: &str, materialization: Materialization, catalog_prefix: &str, ) -> Result<NodeIndex>

Registers a raw model SQL definition into the DAG with a default Parquet format.

Source

pub fn add_model_with_format( &mut self, name: impl Into<String>, raw_sql: &str, materialization: Materialization, output_format: OutputFormat, output_path: Option<String>, catalog_prefix: &str, ) -> Result<NodeIndex>

Registers a raw model SQL definition with explicit OutputFormat and optional output path.

Source

pub fn build_graph(&mut self) -> Result<()>

Resolves dependency edges between models and validates that there are no circular dependencies or layer boundary violations.

Source

pub fn topological_sequence(&self) -> Result<Vec<ModelNode>>

Computes a flat topologically sorted execution sequence.

Source

pub fn execution_tiers(&self) -> Result<Vec<Vec<ModelNode>>>

Computes parallel execution tiers where all models in a tier can be run concurrently.

Source

pub fn primary_source(node: &ModelNode) -> Option<(&str, &str)>

First source('ns','table') dependency, if any.

Source

pub fn bronze_source_ident(node: &ModelNode) -> Option<(String, String)>

Resolve registration identity for a bronze-backed model.

Source

pub fn validate_bronze_sources( &self, project_dir: &Path, mode: BronzeCheckMode, ) -> Result<BronzeValidationReport>

Compile-time bronze frontmatter / scan_path validation.

  • Off — no filesystem checks
  • Warn — missing paths become warnings
  • Fail — missing paths become errors (report.has_errors())
Source§

impl ModelDag

Source

pub fn resolve_select( &self, select: Option<&str>, mode: SelectMode, ) -> Result<HashSet<String>>

Resolve which model names are in the selection.

Source

pub fn subgraph(&self, keep: &HashSet<String>) -> Result<ModelDag>

Return a new DAG containing only keep models (must include all model deps).

Source

pub fn apply_select( &self, select: Option<&str>, mode: SelectMode, ) -> Result<ModelDag>

Apply --select and return a filtered DAG.

Source

pub fn models_with_test_contract(&self) -> Result<Vec<String>>

Names of models that declare a test contract (for default rbt test).

Trait Implementations§

Source§

impl Debug for ModelDag

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ModelDag

Source§

fn default() -> ModelDag

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.