Create Transformations
How to create Transformations
====================================
1. Click "Transformations"
Access the Transformations feature.
2. Create a New Model
Models are a meant to represent a grouping of logical transformation schema
3. Enter a unique name to identify your model and click "Create"
Finalize the creation by clicking "Create".
4. You should now be able to see the newly created model
Click the model to see all the transformations within it
5. Once clicked, you should see all the transformations within the model
In this situation, we haven't created any transformations so it will be empty
6. Click "New Transformation" to create a new transformation within the model
Click "New Transformation" to create a new transformation within the model
7. You should see a list of all eligible source connections and transformations on the left hand side of the page
At the moment, only PostgreSQL and MySQL are supported but we will add support for other sources soon
8. Enter a unique name for the transformation
In this example, we will name the transformation as "payments".
9. Type your SQL statement as a CTE
Type your SQL statement as a CTE. In order to reference a source connection, you MUST use the source designation e.g. {{ source('jaffleshop', 'payments') }}
10. Click "Compile" to run the query
Compile the transformation.
11. Check the format of your results
If your SQL compilation is successful, you should see a preview of your results. Note: Context Data will only return 5 results to the view
12. You can add Description to explain what your transformation does (optional)
Provide a description for the transformation.
13. Click "Save Transformation"
Save the transformation.
14. You should be redirected back to the transformations page.
Click your model and should see the newly created model
15. You can create multiple transformations within your model
In this example, we will create another transformation
16. We're going to create a new transformation called "orders"
Create a new transformation
17. Enter the SQL query
Just the first transformation, we're going to enter the SQL query to create the transformation
18. Click "Compile"
Compile the transformation.
19. Click "Save Transformation"
If your SQL compilation is successful, you should now be able to save the transformation.
20. If we click our model this time, we should see 2 transformations which includes the newly created "orders" transformation
View all transformations within the model
21. Let's create a dependent (downstream) transformation
In the previous examples, we created SQL transformations from source connection data. Now let's use these transformations to create another transformation
22. Enter a transformation name. In this case, we will name this transformation as "customerpayments"
Name the transformation as "customerpayments".
23. Enter the SQL statement for the downstream transformation
In order for us to reference a previously created transformation, make sure to use the ref designation e.g. {{ ref('jaffleshop', 'payments') }}. In this example, you can see that we are referencing both the previously created "payments" and "orders" transformation
24. Click "Compile"
Compile the transformation.
Compile the transformations.
25. You should see that Context data correctly compiled the new SQL statement and correctly referenced the previously created transformations.
View results
26. We're going to add a description to this transformation
Describe the transformation.
27. Click "Save Transformation"
Save the transformation.
28. If we click our model once more, we should see all transformations including the newly created transformation
View all created trasformations
Last updated