The Extract Structured Data transformation component unpacks arrays of structured data—for example, in STRUCT or ARRAY data types—into columns and rows of data in a table. The component is especially useful when using a Custom Connector to access an API that returns data in structured format. The input to this component should include one or more variant-type columns containing a STRUCT or ARRAY that is to be unpacked. The component will operate on every suitable column in the input. Each element in the source structured data can be mapped to a different column in your target table. For example, consider the following array of three elements:Documentation Index
Fetch the complete documentation index at: https://docs.maia.ai/llms.txt
Use this file to discover all available pages before exploring further.
| Name | Flag | Alt_Text |
|---|---|---|
| Cyprus | https://flagcdn.com/w320/cy.png | The flag of Cyprus. |
| Somalia | https://flagcdn.com/w320/so.png | The flag of Somalia. |
| Venezuela | https://flagcdn.com/w320/ve.png | The flag of Venezuela. |
- This component won’t unpack semi-structured data formats such as JSON. For that, you must use the Extract Nested Data component.
- For an alternative method of extracting semi-structured data in a Snowflake project, you can use the Flatten Variant component.
Use case
The Extract Structured Data component is used to flatten and extract fields from structured data such as an ARRAY or STRUCT. Some common uses for this include:- Taking source data where a column contains an array, and putting the array elements into separate table columns to allow further transformations.
- Handling output from the Convert String To Struct component. When you use Convert String To Struct to parse a JSON string into a struct, you can then use Extract Structured Data to make each field in that struct accessible as its own column for filtering, joining, or writing to a table.
Properties
A human-readable name for the component.
Use this property to select which elements from the structured input will be mapped to columns in the output. The Columns dialog shows a graphical representation of every addressable element in the input. If the input has multiple columns of structured data, all will be included here. Each element has a corresponding checkbox. Select an element’s checkbox to include that element in the output. No elements are selected by default.
- To select every element, click Select all.
- To clear every element, click Clear all or Reset.
By default, the output columns will have the same names as the input elements. You can rename the output columns by specifying aliases in this dialog.
- Source Column: Select the source element that you wish to provide an alias for.
- Target Column: Provide a name for the output column.
Choose whether to include input columns in the output.
Determines how to handle input rows that can’t be expanded (for example, because they have no fields to expand, or because they can’t be accessed). Select No to completely omit these rows from the output, or Yes to generate an output row with
NULL values.