Skip to main content

windmill_api/models/
dbt_asset_provenance.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.776.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// DbtAssetProvenance : What dbt says about the model, snapshot, seed or source that produces (or, for a source, is read at) this relation. A dbt project is one runnable node with many model assets, so per-model metadata belongs here rather than on the script.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct DbtAssetProvenance {
17    /// dbt's own node id, e.g. `model.jaffle_shop.customers`.
18    #[serde(rename = "unique_id")]
19    pub unique_id: String,
20    #[serde(rename = "resource_type")]
21    pub resource_type: ResourceType,
22    /// dbt's own word (`table`, `view`, `incremental`, `snapshot`).
23    #[serde(rename = "materialized", skip_serializing_if = "Option::is_none")]
24    pub materialized: Option<String>,
25    /// The Windmill write strategy it maps to, absent for `view` and `ephemeral`, which have none.
26    #[serde(rename = "materialize_strategy", skip_serializing_if = "Option::is_none")]
27    pub materialize_strategy: Option<String>,
28    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
29    pub tags: Option<Vec<String>>,
30    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
31    pub description: Option<String>,
32    #[serde(rename = "data_tests", skip_serializing_if = "Option::is_none")]
33    pub data_tests: Option<Vec<models::DbtAssetProvenanceDataTestsInner>>,
34    /// Declared column metadata (name -> description). NOT column lineage — `manifest.json` carries none.
35    #[serde(rename = "columns", skip_serializing_if = "Option::is_none")]
36    pub columns: Option<std::collections::HashMap<String, serde_json::Value>>,
37    /// A source's declared freshness policy, for the staleness chip.
38    #[serde(rename = "freshness", skip_serializing_if = "Option::is_none")]
39    pub freshness: Option<std::collections::HashMap<String, serde_json::Value>>,
40    /// The model's SQL as written, at the deploy this graph belongs to. Omitted when the caller cannot read the script.
41    #[serde(rename = "raw_code", skip_serializing_if = "Option::is_none")]
42    pub raw_code: Option<String>,
43    /// Its path inside the dbt project, e.g. `models/staging/stg_orders.sql`.
44    #[serde(rename = "original_file_path", skip_serializing_if = "Option::is_none")]
45    pub original_file_path: Option<String>,
46}
47
48impl DbtAssetProvenance {
49    /// What dbt says about the model, snapshot, seed or source that produces (or, for a source, is read at) this relation. A dbt project is one runnable node with many model assets, so per-model metadata belongs here rather than on the script.
50    pub fn new(unique_id: String, resource_type: ResourceType) -> DbtAssetProvenance {
51        DbtAssetProvenance {
52            unique_id,
53            resource_type,
54            materialized: None,
55            materialize_strategy: None,
56            tags: None,
57            description: None,
58            data_tests: None,
59            columns: None,
60            freshness: None,
61            raw_code: None,
62            original_file_path: None,
63        }
64    }
65}
66/// 
67#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
68pub enum ResourceType {
69    #[serde(rename = "model")]
70    Model,
71    #[serde(rename = "snapshot")]
72    Snapshot,
73    #[serde(rename = "seed")]
74    Seed,
75    #[serde(rename = "source")]
76    Source,
77}
78
79impl Default for ResourceType {
80    fn default() -> ResourceType {
81        Self::Model
82    }
83}
84