Append To Grid
Append To Grid
This component will append data to a preexisting grid variable in Matillion ETL. This does not add columns to the grid but can add rows to existing columns.
|Name||Text||The descriptive name for the component.|
|Target Grid||Select||The name of the grid variable that is to be appended.|
|Fixed/Grid||Select||Choose between 'Fixed' data that is entered manually by the user and 'Grid' data that takes an existing grid variable. In both cases, this data is to be appended to the target grid.|
|Values Grid||Select||If 'Fixed' data is chosen, the user can manually enter data for new rows in the Target Grid.|
|Source Grid Variable||Select||If 'Grid' data is chosen, this is the name of the grid to source data from.|
|Column Mapping||Multiple Select||If 'Grid' data is chosen, this allows the user to map columns from the Source Grid to the Target Grid.|
In this example, we have a table that holds flight data from the previous year. We want to make a table with identical metadata for the upcoming year but also including a new field that holds refunds given for particular flights. This involves using the Get Metadata component to copy the original table's metadata and then using the Append To Grid component to append an additional row to the metadata grid before using it to create the new table. The job is shown below.
The metadata for the flights table is shown below. We create a grid variable for the job with fields relating to our expected table metadata.
We then load this grid with metadata using the Get Metadata component before being appended using the Append To Grid component. The new data will be of 'Fixed' format.
The appended data is shown below. It simply gives one more row of data to the grid variable that contains metadata for another table column.
Using the Create/Replace Table component, we can make a new table and use our appended grid in the 'Table Metadata' property. Inside this property, we map the columns of our grid variable to the metadata of the new table.
When run, a grid variable is created and filled with metadata. This metadata is then appended by our own custom row. A table is then created using this metadata. We can then load the table using a Table Input component and use the Metadata tab to check the additional table column is present beside the other columns.