- 08 Sep 2021
- 1 Minute to read
- Print
- DarkLight
- PDF
Dynamic Fields
- Updated on 08 Sep 2021
- 1 Minute to read
- Print
- DarkLight
- PDF
Dynamic fields are used to tell Panoply to use a specific column in your data for one of the properties such as primary key, incremental key or destination prefix. They provide a way to fine tune how Panoply retrieves and stores your data.
Essentially, when you wrap a dynamic field inside curly brackets ({ }), you are telling Panoply to use that field or definition for the Primary Key, Incremental Key or as part of the destination.
For example, if you have a column in a CSV file with a unique value for each row, and that column header is campaign_id
, that column is an ideal candidate to set as the primary key for that data source. To do this, you would type {campaign_id}
into the Primary Key field when defining that data source's advanced options.
You can combine fields for the primary key using dynamic fields as well. For example, if you wanted to use the fields last_name
and zip_code
as a primary key, you would type {last_name}_{zip_code}
.
When working with an API data source, you can change the way Panoply stores your destination tables using dynamic fields as well. For example, the default destination for Shopify data is shopify_{__resource}
. The dynamic field is {__resource}
. If you wanted to keep that dynamic field but change the destination table names to all start with mystore_
, you would change the shopify_
prefix and end up with a destination defined as mystore_{__resource}
. The underscore at the end of the prefix is not required, strictly speaking, but it makes the final table names easier to read.
You can also use multiple dynamic fields together when you define the destination. For example, the destination of a Google Sheets data source entered as sheets_{file name}_{sheet name}
, and your file has a file name of sales figures
and it contained three sheets called summary
, 2018q3
, and 2018q4
, data would be stored on the following destination tables:
sheets_sales figures_summary
sheets_sales figures_2018q3
sheets_sales figures_2018q4
For more information on working with dynamic fields, read our docs on primary keys and incremental keys.