What's Changed
`SwitchTransformer` by angelosantos4 in https://github.com/nodestream-proj/nodestream/pull/202
Switch transformers allow for the manipulation of records that do not arrive in the same format but can be distinguished by a consistent value.
Example:
yaml
- implementation: nodestream.transformers:SwitchTransformer
arguments:
switch_on: !jmespath "type"
cases:
multiple:
implementation: nodestream.transformers:ValueProjection
arguments:
projection: !jmespath "values[*]"
additional_values:
type: !jmespath "type"
Given these inputs:
json
{"type": "single", "value": "1"}
{"type": "multiple", "values": {"value": "2", "value": "3", "value": "4"}}
Produces these output records:
json
{"type": "single", "value": "1"}
{"type": "multiple", "value": "2"}
{"type": "multiple", "value": "3"}
{"type": "multiple", "value": "4"}
Normalize `ValueProvider` by zprobst in https://github.com/nodestream-proj/nodestream/pull/201
Connects Normalizers through so they can be conditionally executed on a per-field basis with a `ValueProvider`.
For example, if you wanted to normalize the `city` field of the record but not the `state` field:
json
{
"city": "New York ",
"state": "NY"
}
The following interpretation would create a `Locality` node with the keys of `New York` and `NY`:
yaml
- implementation: nodestream.interpreting:Interpreter
arguments:
interpretations:
- type: source_node
node_type: Locality
key:
city: !normalize
using: trim_whitespace
data: !jmespath city
state: !jmespath state
**Full Changelog**: https://github.com/nodestream-proj/nodestream/compare/0.10.0...0.10.1