Skip to content

Allow catalogs in any schema yml file#12616

Open
ankit-khare-2015 wants to merge 1 commit intodbt-labs:mainfrom
ankit-khare-2015:issues/11707
Open

Allow catalogs in any schema yml file#12616
ankit-khare-2015 wants to merge 1 commit intodbt-labs:mainfrom
ankit-khare-2015:issues/11707

Conversation

@ankit-khare-2015
Copy link

Resolves #11707

Problem

Catalog definitions are currently loaded only from a dedicated root-level catalogs.yml file.
This prevents users from defining catalogs in regular schema YAML files (for example, models/schema.yml), unlike groups, which can be defined in any schema YAML file.

Solution

This PR updates catalog loading so catalogs can be defined in any schema YAML file under project source paths, while preserving support for root catalogs.yml.

Changes included:

  • Updated catalog loading logic in core/dbt/config/catalogs.py:
    • Continue reading root catalogs.yml if present
    • Also scan schema YAML files under project source paths (all_source_paths)
    • Merge all discovered top-level catalogs: entries
  • Updated CLI integration in core/dbt/cli/requires.py:
    • Pass ctx_project.all_source_paths into load_catalogs(...) so runtime commands load catalogs from schema YAML files
  • Updated schema validation in core/dbt/jsonschemas/resources/latest.json:
    • Added catalogs as a valid top-level key for resource YAML schema validation
  • Added tests:
    • tests/unit/config/test_catalogs.py (new): verifies loading from schema YAML and merge behavior with root catalogs.yml
    • tests/functional/catalogs/test_catalogs_parsing.py: adds end-to-end regression proving catalogs from models/schema.yml are loaded and applied

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@ankit-khare-2015 ankit-khare-2015 requested a review from a team as a code owner March 7, 2026 11:51
@cla-bot
Copy link

cla-bot bot commented Mar 7, 2026

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @ankit-khare-2015

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@github-actions github-actions bot added the community This PR is from a community member label Mar 7, 2026
@cla-bot
Copy link

cla-bot bot commented Mar 9, 2026

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @ankit-khare-2015

@ankit-khare-2015
Copy link
Author

I have completed the Individual CLA form for @ankit-khare-2015. Could you please re-run/check the CLA status for this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community This PR is from a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

define catalogs in any schema yml file

1 participant