Hashboard init
command
The init
command initializes the root of your Hashboard project by creating a .hbproject
file in the directory where it is run.
Stable References for YAML Files
In cases where a Hashboard YAML file does not have a GRN (Global Resource Name), the relative path from the .hbproject
file to the YAML file is used as a stable reference. This ensures a consistent reference to the YAML file, regardless of where hb build
commands are executed.
Once the hb init
command has created the .hbproject
file, hb build
commands can be safely run in the same directory as the .hbproject
file or any of its subdirectories.
Starting out, we recommend the following project structure with the .hbproject
file at the root of your repo and two separate directories for your Hashboard and dbt files.
├── .hbproject
└── hashboard
├── model.yaml
└── dashboard.yaml
└── dbt
└── dbt_project.yml
Configuring Hashboard's dbt Integration
The .hbproject
file can store configuration for Hashboard's dbt integration using the dbtRoot
key. This key specifies the path to the root directory of your dbt project.
There are two ways to set the dbtRoot
value:
- Pass the path to your dbt project root when running the
hb init
command:hb init --dbt-root /path/to/your/dbt/project/root
- Manually edit the
.hbproject
file and modify the dbtRoot key
By setting the dbtRoot
value, Hashboard run the dbt integration during hb build
by default.
The .hbproject file
Below are all the options that can be defined within the .hbproject file. Any value under dbtOptions can also be set using the corresponding environment variable.
.hbproject key | env variable | usage |
---|---|---|
dbtRoot | Path to the root directory of your dbt project | |
dbtOptions: useDefer | HB_DBT_USE_DEFER | "True" or "False" value indicating if Hashboard should look for tables deferred to production in dbt. |
dbtOptions: includeDbNameInSchema | HB_DBT_INCLUDE_DB_IN_SCHEMA | "True" or "False" value indicating if schemas should be qualified with a database name, primarily used when doing cross database deferrals. |
dbtOptions: accountId | HB_DBT_CLOUD_ACCOUNT_ID | The dbt Cloud account id to use when fetching a specific run if creating a build with the --dbt-cloud-run-id flag |
Example
dbtRoot: path/to/folder
dbtOptions:
useDefer: True
includeDbNameInSchema: False
accountId: dbt-cloud-account-id