DBT projectΒΆ
Stride uses dbt to build its energy projection tables.
This tutorial will teach you how to run dbt commands in a project directory.
Create the test project as described at Create a project.
Change to the
dbtdirectory.$ cd test_project/dbt
The file
dbt_project.ymldefines the project.The
modelsdirectory defines several.sqlfiles. Each of these files defines an intermediate view in the overall workflow graph. These SQL queries perform computations on the source datasets in order to build the energy projection table.
Generate the
dbtdocumentation site. This requires the samedbtcommand that stride used to build each project scenario. You will see a command like the example below in your console or in thestride.logfile, which should be in your current directory.It is not necessary to run this command. It is only shown in order to demonstrate how to run the next command for your specific scenario and model_years.
$ dbt run --vars '{"scenario": "baseline", "country": "country_1", "model_years": "(2025,2030,2035,2040,2045,2050,2055)"}'
Run a variation of that command. Note the single vs double quotes in this command. It needs to pass a valid JSON object to
dbt.$ dbt docs generate --vars '{"scenario": "baseline", "country": "country_1", "model_years": "(2025,2030,2035,2040,2045)"}'
Serve the documentation on a port on your local computer. This command should automatically open your browser to a dbt-generated website at
http://localhost:8080.$ dbt docs serve
This web UI shows information about the SQL queries that create all calculated tables. Here is how to navigate to the overall workflow graph for
energy_projection.On the upper left you will see
Projectsandstride.Click
strideand thenmodelswill appear. Click it.All calculated tables will appear. Click
energy_projection.Click the graph-like icon on the bottom right with the title
View Lineage Graph.Click the square on the top right. It will display
View Fullscreenwhen you hover over it.