Flattening
  • 14 Mar 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Flattening

  • Dark
    Light
  • PDF

Article Summary

Flattening

When flattening is enabled, Panoply flattens the nested structure onto the record that contains it. To do this, we prefix the nested attributes with the name of the outer attribute that contains them.

For example, the following record contains a nested location object:

{location: {city: 'San Francisco', state: 'CA', country: 'USA'}}

It would be transformed into this new, flat format:

{location_city: 'San Francisco', location_state: 'CA', location_country: 'USA'}

Each nested property in the location object is replaced by a new attribute on the containing record, where the attribute name is prefixed with location_.

Note that flattening is applicable for nested objects only, not for nested lists. For example, the following record cannot be flattened:

{locations: [ 'one', 'two', 'three' ]}

In Redshift accounts, You can turn flattening on in the metadata section on the tables page. Simply select the field and scroll down to the Nested field and change it to Flatten on parent table.
In Bigquery accounts, the nested data behavior exists directly in the data sources. Either change the default behavior or enter specific field paths and set their nested behavior to flatten.


Was this article helpful?

What's Next