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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.817.0
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// 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.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DbtAssetProvenance {
/// dbt's own node id, e.g. `model.jaffle_shop.customers`.
#[serde(rename = "unique_id")]
pub unique_id: String,
#[serde(rename = "resource_type")]
pub resource_type: ResourceType,
/// dbt's own word (`table`, `view`, `incremental`, `snapshot`).
#[serde(rename = "materialized", skip_serializing_if = "Option::is_none")]
pub materialized: Option<String>,
/// The Windmill write strategy it maps to, absent for `view` and `ephemeral`, which have none.
#[serde(rename = "materialize_strategy", skip_serializing_if = "Option::is_none")]
pub materialize_strategy: Option<String>,
#[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
pub tags: Option<Vec<String>>,
#[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "data_tests", skip_serializing_if = "Option::is_none")]
pub data_tests: Option<Vec<models::DbtAssetProvenanceDataTestsInner>>,
/// Declared column metadata (name -> description) — what `manifest.json` carries, which is only the columns an author wrote down. Omitted when the caller cannot read the script.
#[serde(rename = "columns", skip_serializing_if = "Option::is_none")]
pub columns: Option<std::collections::HashMap<String, serde_json::Value>>,
/// Every column of the relation, typed and in the order the model produces them, from the engine's static analysis. Present only for a project that opted into it, and gated like `columns` and the model's SQL: a full column list is the shape of what the author wrote.
#[serde(rename = "column_schema", skip_serializing_if = "Option::is_none")]
pub column_schema: Option<Vec<models::DbtAssetProvenanceColumnSchemaInner>>,
/// A source's declared freshness policy, for the staleness chip.
#[serde(rename = "freshness", skip_serializing_if = "Option::is_none")]
pub freshness: Option<std::collections::HashMap<String, serde_json::Value>>,
/// The model's SQL as written, at the deploy this graph belongs to. Omitted when the caller cannot read the script.
#[serde(rename = "raw_code", skip_serializing_if = "Option::is_none")]
pub raw_code: Option<String>,
/// Its path inside the dbt project, e.g. `models/staging/stg_orders.sql`.
#[serde(rename = "original_file_path", skip_serializing_if = "Option::is_none")]
pub original_file_path: Option<String>,
}
impl 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.
pub fn new(unique_id: String, resource_type: ResourceType) -> DbtAssetProvenance {
DbtAssetProvenance {
unique_id,
resource_type,
materialized: None,
materialize_strategy: None,
tags: None,
description: None,
data_tests: None,
columns: None,
column_schema: None,
freshness: None,
raw_code: None,
original_file_path: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ResourceType {
#[serde(rename = "model")]
Model,
#[serde(rename = "snapshot")]
Snapshot,
#[serde(rename = "seed")]
Seed,
#[serde(rename = "source")]
Source,
}
impl Default for ResourceType {
fn default() -> ResourceType {
Self::Model
}
}