Skip to content

SEPARATE

Action

Bases: BaseMorphAction

Separate the string values in a single column into any number of new columns on a specified key.

Script template

"SEPARATE > ['destination_field_1', 'destination_field_2', etc. ] < 'by'::['source_field']"

Where 'by' can be any string with one MAJOR caveat. Since :: is used in the query, you cannot use it for separating.

Example

"SEPARATE > ['new_1', 'new_2', 'new_3', 'new_4'] < ';;'::['separate_column']"

Will transform:

ID separate_column
2 Dogs;;Cats;;Fish
3 Cats;;Bats;;Hats;;Mats
4 Sharks;;Crabs

Bitwise into each destination field. If more fields are required than are assigned, will raise an error.

ID separate_column new_1 new_2 new_3 new_4
2 Dogs;;Cats;;Fish Dogs Cats Fish
3 Cats;;Bats;;Hats;;Mats Cats Bats Hats Mats
4 Sharks;;Crabs Sharks Crabs

You will need a different strategy if separation results in more categories than you have destination fields for.