Perform more transformations
Now that you’ve written your joined data into theSocialMediaOutput table, aggregate and rank it using some more transformation components. You’ll then create another new table containing this aggregated and ranked data.
Find the total likes per country using Aggregate
Use the Aggregate component to find the total number of likes for each country in your data set. In part 2, Join is already connected to a Rewrite Table component that writes theSocialMediaOutput table. The Aggregate component branches off the Join output, in parallel with that Rewrite Table component. You don’t need to insert it between them.
- In your
JoinDataSetstransformation pipeline, click the + icon to the right of the Join component to add a connected component. - In the Add component dialog, search for and click the Aggregate component.
- In the properties panel, click the Groupings property, then select the checkbox next to Country.
- Click the Aggregations property. In Column Name, select Likes. In Aggregate Type, select Sum. Click Save.
- Validate the pipeline and sample your data.
sum_Likes.
Rank countries by total number of likes using Rank
Sort your data using the Rank component, in descending order according to the total number of likes.- Click the + icon to the right of the Aggregate component to add a connected component.
- In the Add component dialog, search for and click the Rank component.
- In the component properties panel, leave Partition data empty, so that the component ranks all countries together.
- Click the Ordering within partitions property and configure the ordering settings:
- In Input Column, select sum_Likes.
- In Ordering, select Descending.
- Click Save.
- Click the Functions property and configure a function:
- In Window Function, select Rank.
- In Output Column, enter
CountryRank. - Click Save.
- Validate the pipeline and sample your data.
Write the transformed data to a new table using Rewrite Table
Create a table calledRankedSocialMediaLikes containing this aggregated, ranked data. This table is separate from your SocialMediaOutput table, which contains all your posts and users data.
- Click the + icon to the right of the Rank component to add a connected component.
- In the Add component dialog, search for and click the Rewrite Table component.
- In the component properties panel, in Target table, enter
RankedSocialMediaLikes. - Validate the pipeline.
Automate these pipelines using And and Run Transformation
Link yourLoadSocialMediaData orchestration pipeline to your JoinDataSets transformation pipeline, so that when you run the orchestration pipeline, it automatically runs the transformation pipeline. Use the And and Run Transformation components to do this.
- Open your
LoadSocialMediaDataorchestration pipeline. - Click the + icon to the right of the Google Sheets component to add a connected component.
- In the Add component dialog, search for and click the And component.
- Click and drag the connection ring to the right of the Excel Load component to the And component.
- Click the + icon to the right of the And component to add a connected component.
- In the Add component dialog, search for and click the Run Transformation component.
- In the component properties panel, in Transformation pipeline, select SocialMediaData/JoinDataSets.
- Validate the pipeline.
- Run the pipeline.
LoadSocialMediaData and JoinDataSets pipelines. You only see the orchestration pipeline in the Task history tab at the bottom of the canvas. Click this task to open its details, then expand Run Transformation to see the steps of the transformation pipeline. The RankedSocialMediaLikes table contains one row for each country.
Next steps
You’ve built an orchestration pipeline and a transformation pipeline, and linked them together. To continue learning:- Build a pipeline with Designer and Git in the Maia new user tutorial.
- Run your pipelines automatically with schedules.
- Learn how to share pipelines across projects.