Setting up the dev_payments
model
First off, we'll start by setting up a couple of dev models, as we saw in the About the Sample Project section.
The source table
The source table for the dev_payments
model is the raw.raw_payments
table, which has the following columns:
Creating the dev_payments
model
In the left panel of the Visitran UI, navigate to Models
> No Code
, right click on it and select New Model
.
This brings up a new model dialog.
Let's name the model dev_payments
and click on Create
. This will create the model. Now, select that model from the left panel of the Visitran UI. This will bring up the model configuration dialog.
- Set the
Heirarchy
toRoot model
, which is the default - To configure the source, select the right schema and set the table to
raw_payments
- To configure the destination, select the right schema and set the table to
dev_payments
- Click on
Apply
. This will create the model.
The Transformations
We'll be creating two transformations on top of the source table:
- Rename the
id
column topayment_id
- Add a new column,
amount_in_dollars
, which is theamount
column divided by 100
Let's see how to do this in Visitran in a no-code way.
1. Rename the id
column to payment_id
In Visitran, we can rename a column by clicking on the column name in the data grid and typing the new column name, and saving the changes.
Let's verify that the column has been renamed by looking for the renamed column indicator in the renamed column.
Hovering over the renamed column indicator will show you the original column name.
2. Add a new column, amount_in_dollars
In Visitran, we can add a new column by clicking on the Add Column
button. Adding a column is a fundamental way to transform data in Visitran. You can create new columns by using data from existing columns and transforming them using simple Excel-compatible formulas.
Let's add a new column, amount_in_dollars
, which is the amount
column divided by 100. Let's see how to do this in Visitran using the Excel-compatible formula QUOTIENT()
.
Let's verify that the column has been added by looking for the new column in the data grid.
Done with the dev_payments
model
We've successfully set up the dev_payments
model in Visitran. We've renamed the id
column to payment_id
. While all columns have a type indicator icon, renamed columns have a renamed column indicator, as you can see in the above screenshot for the payment_id
column.
We've also added a new column, amount_in_dollars
using a simple Excel-compatible formula. All new added columns are shown in purple.