Executing Full-Refresh dbt Models

Lab Steps

lock
Understanding Full-Refresh dbt Models
lock
Connecting to the dbt Web IDE
lock
Creating dbt Models Using Table Materialization
lock
Executing Full-Refresh dbt Models
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 models you previously defined and check that the tables are completely refreshed.

 

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 from the logs, dbt has built both the models you defined and also the models that were already in the lab environment.

 

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

Copy code
1
psql -U postgres -d ca_dbt

 

5. Enter the following SQL query to retrieve the first 10 rows in the d_usa_customers table:

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

alt

The model_datetime should be near the datetime you built the model.

 

6. Exit from the database terminal by entering CTRL + Z, and perform dbt execution again by enetring the following command:

Copy code
1
dbt run

 

7. Enter again in the database by executing the psql -U postgres -d ca_dbt command, and execute the SQL query to check that the records are fresh:

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

alt

As you can see, the model_datetime changed. This means that the rows are fresh.

 

Summary

In this lab step, you executed the dbt models you previously defined and checked that the tables are completely refreshed.

Validation checks
1Checks
Executed the dbt Models

Check whether the dbt models have been executed.

Data build tool (dbt)