metadata set for debug
Set the metadata for items in the stream.
Signature
> metadata set {flags} (closure)
Flags
--datasource-ls, -l: (DEPRECATED) Assign the DataSource::Ls metadata to the input.--datasource-filepath, -f {path}: Assign the DataSource::FilePath metadata to the input.--path-columns, -p {list<string>}: Assign path columns metadata to the input.--content-type, -c {string}: Assign content type metadata to the input.--merge, -m {record}: Merge arbitrary metadata fields.
Parameters
closure: A closure that receives the current metadata and returns a new metadata record. Cannot be used with other flags.
Input/output types:
| input | output |
|---|---|
| any | any |
Examples
Set the metadata of a table literal so the name column is treated as a path.
> [[name color]; [Cargo.lock '#ff0000'] [Cargo.toml '#00ff00'] [README.md '#0000ff']] | metadata set --path-columns [name]Set the metadata of a file path.
> 'crates' | metadata set --datasource-filepath $'(pwd)/crates'Set the content type metadata.
> 'crates' | metadata set --content-type text/plain | metadata | get content_type
text/plainSet custom metadata.
> "data" | metadata set --merge {custom_key: "value"} | metadata | get custom_key
valueSet metadata using a closure.
> "data" | metadata set --content-type "text/csv" | metadata set {|m| $m | update content_type {$in + "-processed"}} | metadata | get content_type
text/csv-processed