> ## 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.

# Pipelines tutorial part 2: Transform data

In this part of the tutorial, you'll create a transformation pipeline that converts some data into numbers, joins the two data sets you loaded in [part 1](https://docs.maia.ai/docs/guides/pipelines-tutorial-load-data.md), and writes the result to a new table in your data warehouse.

***

## Create a transformation pipeline

Now that you have your data, it's time to transform it. Create a transformation pipeline called `JoinDataSets` in your `SocialMediaData` folder.

1. Click **Files** to open the **Files** panel.
2. Click the three dots **...** next to the `SocialMediaData` folder, then **Add**, then select **Transformation pipeline**.
3. In the **Pipeline name** field, name this pipeline `JoinDataSets`.
4. Optionally, in the **Description** field, enter a description for the pipeline.

The new transformation pipeline opens on the canvas.

### Bring your data into the pipeline using Table Input

Transformation pipelines don't begin with a **Start** component, like orchestration pipelines do. Instead, they start with a component that provides data for transformation.

To connect the data that you loaded in your `LoadSocialMediaData` orchestration pipeline to this transformation pipeline, use two [Table Input](https://docs.maia.ai/docs/components/table-input.md) components, one for each table.

1. In your transformation pipeline, click the **+** icon at the top left of the canvas to add the first component to this pipeline.
2. In the **Add component** dialog, search for and click the **Table Input** component.
3. In the component properties panel, adjust the following settings:
   * In **Database** and **Schema**, select **\[Environment Default]**.
   * In **Target table**, select the **posts** table.
   * Click the **Column names** property, select the **All** checkbox to include all columns from this table.
4. Click the **+** icon at the top left of the canvas to add another component.
5. In the **Add component** dialog, search for and click the **Table Input** component.
6. In the component properties panel, adjust the following settings:
   * In **Database** and **Schema**, select **\[Environment Default]**.
   * In **Target table**, select the **users** table.
   * Click the **Column names** property, select the **All** checkbox to include all columns from this table.
7. Validate the pipeline and sample your data. Sample the data for both **Table Input** components, to make sure both data sets have been brought into the transformation pipeline correctly.

***

## Transform your data

Next, convert some data into numbers, join the two data sets, and write your transformed data to a new table in your data warehouse.

### Convert the Likes and UserID data to numbers using Convert Type

After sampling the data in your `posts` **Table Input** component, you'll notice that the data in the `Likes` and `UserID` columns appears as numbers with a decimal point. This is because Excel Load guesses each column's data type from the cell formatting, so numbers load as decimals (FLOAT). Convert the data in these columns to whole numbers. This is more accurate for `Likes`, because a post can't have half a "like". It's also needed for `UserID`: in the `users` table, `UserID` is already a whole number, so converting it in `posts` gives both columns the same data type for the join. To do this, use the [Convert Type](https://docs.maia.ai/docs/components/convert-type.md) component.

1. Click the **+** icon to the right of the `posts` **Table Input** component to add a connected component.
2. In the **Add component** dialog, search for and click the **Convert Type** component.
3. In the component properties panel, click the **Conversions** property, and configure two conversions:
   1. In the first row, in **Column** select **UserID**, and in **Type** select **NUMBER**. Leave the **Size** and **Precision** fields empty.
   2. Click the **+** icon in the bottom left to add another row.
   3. In the second row, in **Column** select **Likes**, and in **Type** select **NUMBER**. Leave the **Size** and **Precision** fields empty.
4. Click **Save**.
5. Validate the pipeline and sample your data.

### Join the data from Excel and Google Sheets using Join

Join your `posts` and `users` tables together using the [Join](https://docs.maia.ai/docs/components/join.md) component.

1. Click the **+** icon to the right of the **Convert Type** component to add a connected component.
2. In the **Add component** dialog, search for and click the **Join** component.
3. Click and drag the connection ring to the right of the `users` **Table Input** component to the **Join** component.
4. Click the **Join** component to open its component properties panel.
5. Click the **Main table** property, and select **Convert Type**.
6. In the **Main table alias** property, enter `posts`.
7. Click the **Joins** property and configure how to join the tables:
   * In **Join Table**, select **users**.
   * In **Join Alias**, enter `users`.
   * In **Join Type**, select **Inner**.
   * Click **Save**.
8. Click the **Join expressions** property, enter the following expression: `"posts"."UserID" = "users"."UserID"`, then click **Save**.
9. Click the **Column mappings** property and configure the mappings:
   1. In the bottom left, click **Add all**.
   2. Select the checkboxes for the following columns:
      * **posts.PostID**
      * **posts.RowId**
      * **posts.UserID**
      * **users.id**
      * **users.UserID**
   3. Click the **-** icon to remove these columns from the selection, because you don't want them included in your data.
   4. Click **Save**.
10. Validate the pipeline and sample your data.

### Write the combined data to a new table using Rewrite Table

Create a new table called `SocialMediaOutput` that contains your combined data, using the [Rewrite Table](https://docs.maia.ai/docs/components/rewrite-table.md) component.

1. Click the **+** icon to the right of the **Join** component to add a connected component.
2. In the **Add component** dialog, search for and click the **Rewrite Table** component.
3. In the component properties panel, in **Target table**, enter `SocialMediaOutput`.
4. Validate the pipeline.

> [!NOTE]
>
> Sampling isn't available for the **Rewrite Table** component, because it uses the data in the component immediately before it.

***

## Run the transformation pipeline

Click **Run** on the canvas.

This transformation pipeline runs. It converts your likes and user ID data to number format, joins your two data sets together, creates a table called `SocialMediaOutput`, and writes your data into this table in your data warehouse. You can see the progress of this task in the **Task history** tab at the bottom of the canvas.

***

## Next steps

In [part 3](https://docs.maia.ai/docs/guides/pipelines-tutorial-aggregate-and-automate.md), you'll aggregate and rank the joined data, then run both pipelines in sequence.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.