Command | Description |
---|---|
dbt run |
Run the models |
dbt run --select ethereum |
Run all models under the ethereum/ directory |
dbt run --select ethereum.blocks |
Run just the blocks model under the ethereum/ directory |
dbt run --select blocks |
Run the model named blocks |
dbt test |
Run all dbt tests (schema and custom) |
dbt test --select ethereum |
Run all tests for all models under the ethereum/ directory |
dbt test --select ethereum.blocks |
Run all tests for the blocks model under the ethereum/ directory |
dbt test --select blocks |
Run all tests for the model named blocks |
dbt build |
Run all models and tests for all models |
dbt build --select ethereum |
Run all models and tests for all models under the ethereum/ directory |
dbt build --select ethereum.blocks |
Run all models and tests for the blocks model under the ethereum/ directory |
dbt build --select blocks |
Run all models and tests for the model named blocks |
dbt compile |
Compile/hydrate but do not run or test for all models |
dbt compile --select ethereum |
Compile/hydrate but do not run or test for all models under the ethereum/ directory |
dbt compile --select ethereum.blocks |
Compile/hydrate but do not run or test for the blocks model under the ethereum/ directory |
dbt compile --select blocks |
Compile/hydrate but do not run or test for the model named blocks |
dbt debug |
Ensure profile configurations work and connection to warehouse is successful |
Note: It is recommended to use a virtual environment
- Install dependencies
pip install -r requirements.txt
- Create a file called
.env
in the root of the directory
touch .env
- Add necessary environment variables to the file
Note: Replace xxx
with the values found in 1Password. Keep DBT_PROFILES_DIR
as is.
DBT_PROFILES_DIR=.
CH_ADMIN_PASSWORD=xxx
CH_HOST=xxx
- Source the
.env
file
export $(grep -v '^#' .env | xargs)
- Ensure the credentials work
dbt debug
- Build all models and run tests before you start developing to ensure everything is working prior to you making changes
Note: Views will show in test databases instead of production. So if you're building there Ethereum models, the
views will appear in ethereum_test
instead of ethereum
.
dbt build
Note: It is highly recommended that you let the CI pipeline handle deployments to production. You should not do this manually unless you have a compelling reason.
To run or test production views, you need to use the production target defined in the profiles.yml
file. To do this by
using the --target
/-t
flag when calling dbt commands
dbt build --target prod
dbt build -t prod
Common errors and what to do
Ensure that you have sourced the .env
file if you're following the dev setup above 👆
export $(grep -v '^#' .env | xargs)
- Learn more about dbt in the docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the blog for the latest news on dbt's development and best practices