Docs
Generate staging models

Generate staging models

Automate the creation of staging models from source tables

Generating staging model by right clicking on a source.Generating staging model by right clicking on a source.

You can easily generate staging models directly from a source table in Y42. Right-click on the desired source table and select the Generate Staging Model option.

This action will automatically create a models/staging/ directory if it's not already present. Additionally, it will generate a new model with the naming convention stg_{source_name}__{source_table}, uniquely identifying the staging model derived from your specific source table.

Committing changes

Upon committing, two new files are automatically created:

  • The staging model SQL file: This file contains the SQL code for the newly created staging model.
  • The associated .yml file: This file is used for configuration and documentation purposes.
/models/staging/stg_src_hubspot__campaigns.sql
/models/staging/stg_src_hubspot__campaigns.yml

_13
WITH
_13
_13
source AS (
_13
SELECT * FROM {{ source('src_hubspot', 'campaigns') }}
_13
),
_13
_13
renamed AS (
_13
SELECT
_13
...
_13
FROM source
_13
)
_13
_13
SELECT * FROM renamed