- Ubuntu 22.04.3 LTS (Jammy Jellyfish)
- Docker version 24.0.7
-
Clone this repository to local
-
Move to the docker folder
cd dbt-trino-python/docker
-
Create a network
docker network create --driver=bridge --subnet=172.30.0.0/16 --gateway=172.30.0.1 shared-network
-
Create a container
docker compose up -d --build
-
The following containers will be up
- dbt_host
- This repository is mounted to
/home/dbt_projects
- This repository is mounted to
- postgres_host
- Initial data is automatically inserted.
- dbt_host
-
Enter the container
docker exec -it dbt_host /bin/bash
-
Activate the venv
source /home/venvs/dbt/bin/activate dbt --version # The output should be like the below. # Core: # - installed: 1.7.4 # - latest: 1.7.4 - Up to date! # # Plugins: # - postgres: 1.7.4 - Up to date!
-
Move to the dbt project folder
cd /home/dbt_projects/crypto_etl
-
Run the following dbt commands
-
Debug to check if the dbt configuration is proper.
dbt debug
-
Run the example model
dbt run --select example
-
Test the example model
dbt test --select example
-
-
Check the working directory.
pwd # /home/dbt_projects/crypto_etl
-
Compiling check
dbt compile
-
Run the following dbt commands
-
Run the custom model
dbt run --select get_stats
-
Test the custom model
-
A new table is created by running the model above.
-
And the model has composite key which is composed by id and week_num columns.
-
Therefore, in the test, check the composite key is unique.
-
The test is defined in
dbt_projects/crypto_etl/models/get_stats/schema.yml
dbt test --select get_stats
-
-
-
Put CSV files in
dbt_projects/crypto_etl/seeds
that you want to import -
Check the working directory.
pwd # /home/dbt_projects/crypto_etl
-
Run the following command.
dbt seeds --select init
-
Create a packages.yml in the same directory of dbt_project.yml
-
Write package name that you want.
packages: - package: dbt-labs/dbt_utils version: 1.1.1
-
Install the packages. Run the command from
dbt_projects/crypto_etl
in my case.dbt deps