5d3e86e2a48adf7a308773f8f1b725d187c7c5ef

Author
Miguel Sempere <msempere@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

feat(dbt): create plugin (#11635)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>

Diff

 1diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
 2index 599b765ca605a742196cdceb632708937b21bc33..0c5f3aceece0233d1fc4f200136786499b31f782 100644
 3--- a/.github/CODEOWNERS
 4+++ b/.github/CODEOWNERS
 5@@ -10,3 +10,4 @@ plugins/universalarchive/           @Konfekt
 6 plugins/wp-cli/                     @joshmedeski
 7 plugins/zoxide/                     @ajeetdsouza
 8 plugins/starship/                   @axieax
 9+plugins/dbt/                        @msempere
10diff --git a/plugins/dbt/README.md b/plugins/dbt/README.md
11new file mode 100644
12index 0000000000000000000000000000000000000000..e05d79cc322f082a2a5261e4bcd747cc23199844
13--- /dev/null
14+++ b/plugins/dbt/README.md
15@@ -0,0 +1,29 @@
16+# dbt plugin
17+
18+## Introduction
19+
20+The `dbt plugin` adds several aliases for useful [dbt](https://docs.getdbt.com/) commands and
21+[aliases](#aliases).
22+
23+To use it, add `dbt` to the plugins array of your zshrc file:
24+
25+```
26+plugins=(... dbt)
27+```
28+
29+## Aliases
30+
31+| Alias  | Command                                          | Description                                          |
32+| ------ | ------------------------------------------------ | ---------------------------------------------------- |
33+| dbtlm  | `dbt ls -s state:modified`                       | List modified models only                            |
34+| dbtrm  | `dbt run -s state:modified`                      | Run modified models only                             |
35+| dbttm  | `dbt test -m state:modified`                     | Test modified models only                            |
36+| dbtrtm | `dbtrm && dbttm`                                 | Run and test modified models only                    |
37+| dbtrs  | `dbt clean; dbt deps; dbt seed`                  | Re-seed data                                         |
38+| dbtfrt | `dbtrs; dbt run --full-refresh; dbt test`        | Perform a full fresh run with tests                  |
39+| dbtcds | `dbt docs generate; dbt docs serve`              | Generate docs without compiling                      |
40+| dbtds  | `dbt docs generate --no-compile; dbt docs serve` | Generate and serve docs skipping doc. re-compilation |
41+
42+## Maintainer
43+
44+### [msempere](https://github.com/msempere)
45diff --git a/plugins/dbt/dbt.plugin.zsh b/plugins/dbt/dbt.plugin.zsh
46new file mode 100644
47index 0000000000000000000000000000000000000000..6fcc2eecfca7c6c09735fb3028ebcd216ce0c91c
48--- /dev/null
49+++ b/plugins/dbt/dbt.plugin.zsh
50@@ -0,0 +1,23 @@
51+# list modified models only
52+alias dbtlm="dbt ls -s state:modified"
53+
54+# run modified models only
55+alias dbtrm="dbt run -s state:modified"
56+
57+# test modified models only
58+alias dbttm="dbt test -m state:modified"
59+
60+# run and test modified models only
61+alias dbtrtm="dbtrm && dbttm"
62+
63+# re-seed data
64+alias dbtrs="dbt clean; dbt deps; dbt seed"
65+
66+# perform a full fresh run with tests
67+alias dbtfrt="dbtrs; dbt run --full-refresh; dbt test"
68+
69+# generate and serve docs
70+alias dbtcds="dbt docs generate; dbt docs serve"
71+
72+# generate and serve docs skipping doc. re-compilation
73+alias dbtds="dbt docs generate --no-compile; dbt docs serve"