-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile
executable file
·66 lines (47 loc) · 1.09 KB
/
Taskfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
DB=data/wonderful.db
function init() {
# Install the required dependencies
pip install -r requirements.txt
pre-commit install
}
function build() {
# Build the dbt project
dbt deps
dbt seed
dbt run
}
function test() {
# Run the dbt tests
dbt test
}
function clean() {
# Remove all generated artifacts
rm -f ${DB}
dbt clean
}
function docs() {
# Generate and serve the dbt documentation
dbt docs generate
dbt docs serve --no-browser
}
function preview() {
# Preview the table content or schema
if [ "${1}" = "table" ]; then
PREVIEW_CMD="TABLE"
elif [ "${1}" = "schema" ]; then
PREVIEW_CMD="SHOW TABLE"
else
echo "Unrecognized option '${1}'"
exit 1
fi
echo '.mode minimal; select table_schema, table_name from information_schema.tables' \
| duckcli ${DB} -t \
| awk '{printf "%s.%s\n", $1, $2}' \
| fzf --tac --preview "echo '${PREVIEW_CMD} {}' | duckcli ${DB} -t"
}
function explore() {
# Open the database CLI interface
duckcli ${DB}
}
"${@}"