Base Node Types
Overview
Coalesce base Node Types to construct facts and dimensions.
Installation
- Copy the Package ID:
@coalesce/databricks/base-node-types - In Coalesce, open the Workspace where you wish to install the package.
- Go to the Build Setting of the Workspace, tab Packages, and click the Install button on the top right of the page.
- Paste the Package ID, and proceed with the installation process.
Description
Coalesce Databricks Base Node Types Package
The Coalesce Base Node Types Package includes:
Work
The Coalesce work node is a versatile node that allows you to develop and deploy a Work table/view in Databricks.
A Work node serves as an intermediary object and is commonly employed to store raw data before undergoing the crucial phases of transformation and loading into the main tables of the data warehouse.
This pivotal step ensures that the raw data is processed and structured effectively.
Work Node Configuration
The Work node type has two configuration groups:
Work Node Properties
| Property | Description |
|---|---|
| Storage Location | Storage Location where the WORK will be created |
| Node Type | Name of template used to create node objects |
| Description | A description of the node's purpose |
| Deploy Enabled | If TRUE the node will be deployed / redeployed when changes are detected If FALSE the node will not be deployed or will be dropped during redeployment |
Work Options
You can create the node as:
Work Options Table
| Property | Description |
|---|---|
| Multi Source | Toggle: True/False Implementation of SQL UNIONs True: Combine multiple sources in a single node True Options: - UNION: Combines with duplicate elimination - UNION ALL: Combines without duplicate elimination - INSERT: Individual insert for each source False: Single source node or multiple sources combined using a join |
| Truncate Before | Toggle: True/False This determines whether a table will be overwritten each time a task executes. True: Uses INSERT OVERWRITE False: Uses INSERT to append data |
| Enable tests | Toggle: True/False Determines if tests are enabled |
| Distinct | Toggle: True/False True: Group by All is invisible. DISTINCT data is chosen for processing False: Group by All is visible |
| Group by All | Toggle: True/False True: DISTINCT is invisible. Data is grouped by all columns for processing False: DISTINCT is visible |
| Order By | Toggle: True/False True: Sort column and sort order drop down are visible and are required to form order by clause False: Sort column and sort order drop down are invisible |
| Pre-SQL | SQL to execute before data insert operation |
| Post-SQL | SQL to execute after data insert operation |
Work Options View
| Setting | Description |
|---|---|
| Override Create SQL | Toggle: True/False True: Customized Create SQL specified in the Create SQL space is executed. All other options are invisible False: Create view SQL based on options chosen are framed and executed |
| Multi Source | Toggle: True/False Implementation of SQL UNIONs True: Combine multiple sources in a single node True Options: - UNION: Combines with duplicate elimination - UNION ALL: Combines without duplicate elimination False: Single source node or multiple sources combined using a join |
| Distinct | Toggle: True/False True: Group by All is invisible. DISTINCT data is chosen for processing False: Group by All is visible |
| Group by All | Toggle: True/False True: DISTINCT is invisible. Data is grouped by all columns for processing False: DISTINCT is visible |
Work Joins
Join conditions and other clauses can be specified in the join space next to mapping of columns in the UI.
📘 Specify Group by and Order by Clauses
You should specify group by and order by clauses in this space if you are not opting for the group by all and order by provided in OPTIONS config.
Work Deployment
Work Initial Deployment
When deployed for the first time into an environment the Work node of materialization type table will execute the below stage:
| Stage | Description |
|---|---|
| Create Work Table | This will execute a CREATE OR REPLACE statement and create a table in the target environment |
| Create Work View | This will execute a CREATE OR REPLACE statement and create a view in the target environment |
Work Redeployment
After the WORK node with materialization type table has been deployed for the first time into a target environment, subsequent deployments may result in either altering the WORK Table or recreating the WORK table.
Altering the Work Tables
A few types of column or table changes will result in an ALTER statement to modify the Work Table in the target environment, whether these changes are made individually or all together:
- Changing table names
- Dropping existing columns
- Altering column data types
- Adding new columns
The following stages are executed:
| Stage | Description |
|---|---|
| Clone Table | Creates an internal table |
| Rename Table| Alter Column | Delete Column | Add Column | Edit table description | Alter table statement is executed to perform the alter operation |
| Swap Cloned Table | Upon successful completion of all updates, the clone replaces the main table ensuring that no data is lost |
| Delete Table | Drops the internal table |
Recreating the Work Tables
If any of the following change are detected, then the table will be recreated using a CREATE or REPLACE.
- Join clause
- Adding transformation
- Changes in configuration like adding distinct, group by, or order by
One of the following stages are executed:
| Stage | Description |
|---|---|
| Create Table | Creates a new table |
| Replace Table | Replaces an existing table |
Recreating the Work Views
The subsequent deployment of Work node of materialization type view with changes in view definition, adding table description or renaming view results in deleting the existing view and recreating the view.
The following stages are executed:
| Stage | Description |
|---|---|
| Delete View | Removes existing view |
| Create View | Creates new view with updated definition |
Work Undeployment
If a Work Node of materialization type table is deleted from a Workspace, that Workspace is committed to Git and that commit deployed to a higher level environment then the WorkTable in the target environment will be dropped.
This is executed in two stages:
| Stage | Description |
|---|---|
| Delete Table | Coalesce Internal table is dropped |
| Delete Table | Target table in Databricks is dropped |
If a Work Node of materialization type view is deleted from a Workspace, that Workspace is committed to Git and that commit deployed to a higher level environment then the WorkView in the target environment will be dropped.
The stage executed:
| Stage | Description |
|---|---|
| Delete View | Drops the existing Work view from target environment |
Persistent Stage
The Coalesce Persistent Stage Nodes element, serving as an intermediary object, is frequently utilized to maintain data persistence across multiple execution cycles.
It plays a crucial role in tracking the historical changes of columns linked to business keys.
This functionality is particularly beneficial when the objective is to retain raw data for prolonged durations.
Persistent Stage Node Configuration
The Persistent node type has two configuration groups:
Persistent Stage Node Properties
| Property | Description |
|---|---|
| Storage Location | Storage Location where the WORK will be created |
| Node Type | Name of template used to create node objects |
| Description | A description of the node's purpose |
| Deploy Enabled | If TRUE the node will be deployed / redeployed when changes are detected If FALSE the node will not be deployed or will be dropped during redeployment |