dbt-labs / dbt-labs/docs.getdbt.com
Dbt Docs generate command with select models does not honour exclusions
- Dominant language
- JavaScript
- Stars
- 215
- Forks
- 1.2k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 130
Description
I run the below dbt docs generate command in order to get the catalog.json/manifest.json file so that I can export that to DataHub. I am trying to exclude some of the models using the code below, but it does not exclude the models and stills looks for it while running the command. Could you please advise how best to fix it?
I am running with DBT core 1.9.4. The below is the GitHub action.
```
# Below step tries to solve this error on this workflow:
# Encountered an error while generating catalog: An error occurred (EntityNotFoundException) when calling the GetTables operation: Database a_datamarts_snapshot_2026_05_31 not found.
- name: Build DBT Docs
id: generate_docs
run: |
set -euo pipefail
EXCLUSIONS=(
"tag:corporate_epm_snapshot"
"tag:corporate_hr_dm_snapshot"
"path:models/people/a_datamarts_snapshot+"
"path:models/people/a_datamarts_snapshot_latest+"
"path:models/people/people_datamarts_snapshot+"
"path:models/people/people_datamarts_snapshot_latest+"
"path:models/people/people_monitoring+"
"path:people/people_monitoring+"
"name:people_monitoring__*"
)
EXCLUDE_ARGS=()
for exclusion in "${EXCLUSIONS[@]}"; do
EXCLUDE_ARGS+=(--exclude "$exclusion")
done
mapfile -t SELECTORS < <(
dbt --quiet ls \
--resource-type model \
--select "path:models" \
"${EXCLUDE_ARGS[@]}" \
--output json \
| jq -r 'select(.name != null) | .name'
)
if [ ${#SELECTORS[@]} -eq 0 ]; then
echo "No models selected for dbt docs generation."
exit 1
fi
dbt docs generate \
--target prod \
--threads 10 \
--select "path:models" \
"${EXCLUDE_ARGS[@]}" \
| tee docs_generate.txt
STATUS=${PIPESTATUS[0]}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.