Node Aliases
By default, Coalesce uses the source table and node name as the SQL alias when referencing data in a Node. For example:
FROM {{ ref('SAMPLE', 'ORDERS') }} "ORDERS"
This can make SQL expressions longer or harder to follow, especially when joining multiple tables. To simplify your SQL, you can assign a shorter alias, like custorders in the JOIN tab:
FROM {{ ref('SAMPLE', 'ORDERS') }} "custorders"
Adding the Alias
To use the alias properly, update the Transform field for each column.
- Open the Mapping tab of your Node in the Node Editor.
- Select all the Node columns.
- Go to Bulk Edit and select the Transform attribute.
- Enter in the alias and column. For example
"custorders".{{SRC}}. - Preview to make sure the change is correct.
Apply SQL Functions
You can still use SQL functions such as UPPER, TRIM, or CAST with your alias. Just reference the column using the alias in the Transform field. For example:
If your alias is custorders and you want to uppercase O_ORDERSTATUS, enter this in the Transform field:
UPPER("custorders"."O_ORDERSTATUS")