Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
simplify construction
Browse files Browse the repository at this point in the history
  • Loading branch information
marijncv authored and cmpadden committed Dec 12, 2024
1 parent 24b98d8 commit eb73e89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ fn main() -> Result<(), DagsterPipesError> {

let asset_metadata = HashMap::from([(
"row_count".to_string(),
PipesMetadataValue {
raw_value: Some(RawValue::Integer(100)),
pipes_metadata_value_type: Some(Type::Int),
},
PipesMetadataValue::new(RawValue::Integer(100), Type::Int),
)]);
context.report_asset_materialization("example_rust_subprocess_asset", asset_metadata);

Expand Down
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ pub enum AssetCheckSeverity {
Error,
}

impl PipesMetadataValue {
pub fn new(raw_value: types::RawValue, pipes_metadata_value_type: types::Type) -> Self {
Self {
raw_value: Some(raw_value),
pipes_metadata_value_type: Some(pipes_metadata_value_type),
}
}
}

// partial translation of
// https://github.com/dagster-io/dagster/blob/258d9ca0db/python_modules/dagster-pipes/dagster_pipes/__init__.py#L859-L871
#[derive(Debug)]
Expand Down

0 comments on commit eb73e89

Please sign in to comment.