Lab Steps

lock
Understanding What Are dbt Jinja Macros
lock
Connecting to the dbt Web IDE
lock
Defining a Custom dbt Macro
lock
Creating a Model Leveraging dbt Macros
lock
Executing the dbt Model
Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

Introduction

In this lab step, you will execute the dbt model you previously defined, and will check that the dbt macros have been invoked.

 

Instructions

1. Open the terminal by clicking on Terminal -> New Terminal:

alt

 

2. Move into the dbt project folder by entering the following command:

Copy code
1
cd ca_dbt_project

 

3. Execute the following command to build the dbt project:

Copy code
# The export command is needed to let dbt know the profiles file is in the current directory
export DBT_PROFILES_DIR='.'
dbt run

After a few seconds, dbt will complete the execution with an output similar to the following:

alt

As you can see, two views have been created. The first one is the stg_orders model that was already in the lab environment, the second one is the d_orders model that you just defined (because no materialization type has been defined, it has been materialized as a view).

 

4. Execute the following command to log into the database:

Copy code
1
psql -U postgres -d ca_dbt

 

5. Execute the following SQL query to retrieve the first 10 rows of the d_orders view:

Copy code
1
select * from dbt_outputs.d_orders limit 10;

alt

These orders have all been shipped.

 

6. Execute the following SQL query to retrieve 10 orders that have not been shipped:

Copy code
1
select * from dbt_outputs.d_orders where shipping_status != 'shipped' limit 10;

alt

 

Summary

In this lab step, you executed the dbt model you previously defined, and checked that the dbt macros have been invoked.

Validation checks
1Checks
Executed the dbt Models

Check whether the dbt models have been executed.

Data build tool (dbt)