We recommend using VS Code if you don't currently have a preference.
Make sure you check in the util readme if you need to configure IDE settings to make them work!
- vscode-dbt
- dbt Power User
- Rainbow CSV
- GitLens
- Better Jinja
- Find Related Files
- GitHub Pull Requests and Issues
- Todo Tree
- YAML
- Copy file name
The following will remap Markdown, Yaml and SQL files to use the Jinja-flavoured interpreter:
"files.associations":{
"*.md": "jinja-md",
"*.yml": "jinja-yaml",
"*.sql": "jinja-sql",
},
The following will configure Related Files rules for raw / compiled models:
"findrelated.rulesets": [
{
"name": "sql",
"rules": [
{
"pattern": "^(.*/)?models/(.*/)?(.+\\.sql)$",
"locators": [
"**/compiled/**/$3"
]
},
{
"pattern": "^(.*/)?compiled/(.*/)?(.+\\.sql)$",
"locators": [
"**/run/**/$3"
]
},
{
"pattern": "^(.*/)?run/(.*/)?(.+\\.sql)$",
"locators": [
"**/models/**/$3"
]
}
]
}
],
The following will configure spacing/indentation rules to follow the style guide:
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
},
"[sql]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"[jinja-yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
},
"[jinja-sql]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"editor.detectIndentation": false,
"editor.rulers": [
{ "column": 80, "color": "#403558" }
],
The following will disable SQL syntax highlight for the files under the target/ directory:
"files.associations": {
"**/target/**/**/*.sql": "plaintext"
}
For more, do regurarly check our awesome-dbt
To setup add this to your .bashrc/.zshrc
function dbt_run_changed() {
children=$1
models=$(git diff --name-only | grep '\.sql$' | awk -F '/' '{ print $NF }' | sed "s/\.sql$/${children}/g" | tr '\n' ' ')
echo "Running models: ${models}"
dbt run --models $models
}
To setup add this to your .bashrc/.zshrc
FZF_DBT_PATH=~/.fzf-dbt/fzf-dbt.sh
if [[ ! -f $FZF_DBT_PATH ]]; then
FZF_DBT_DIR=$(dirname $FZF_DBT_PATH)
print -P "%F{green}Installing fzf-dbt into $FZF_DBT_DIR%f"
mkdir -p $FZF_DBT_DIR
command curl -L https://raw.githubusercontent.com/Infused-Insight/fzf-dbt/main/src/fzf_dbt.sh > $FZF_DBT_PATH && \
print -P "%F{green}Installation successful.%f" || \
print -P "%F{red}The download has failed.%f"
fi
export FZF_DBT_PREVIEW_CMD="cat {}"
export FZF_DBT_HEIGHT=80%
source $FZF_DBT_PATH
To get sound notification after a long running dbt command has finished
dbt run && say beep