Fix selecting model when it has the same name as folder#2328
Conversation
✅ Deploy Preview for astronomer-cosmos canceled.
|
b979751 to
f55da89
Compare
4fe7fdb to
1084de7
Compare
efb4d71 to
fbaeb3c
Compare
There was a problem hiding this comment.
Pull request overview
This PR addresses Cosmos selecting multiple dbt nodes unintentionally (e.g., model name colliding with a directory name) by switching task selection to use dbt’s fully-qualified-name (FQN) when available.
Changes:
- Add
fqntoDbtNodeand populate it from bothdbt lsoutput andmanifest.json. - Generate dbt task commands using
--select fqn:...whenfqnis present. - Update unit/integration tests to expect the new selection syntax and updated
dbt lsargument counts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
cosmos/dbt/graph.py |
Adds fqn to node metadata, parses it from dbt artifacts, and requests it via dbt ls --output-keys. |
cosmos/airflow/graph.py |
Uses fqn: selectors when building task metadata for models/buildable resources. |
tests/test_converter.py |
Updates converter integration assertions to expect fqn: selectors. |
tests/operators/test_watcher.py |
Updates watcher command assertion to expect fqn: selector. |
tests/dbt/test_graph.py |
Adjusts expected dbt ls command argument counts due to added fqn output key. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2328 +/- ##
=======================================
Coverage 97.90% 97.91%
=======================================
Files 102 102
Lines 6840 6845 +5
=======================================
+ Hits 6697 6702 +5
Misses 143 143 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tatiana
left a comment
There was a problem hiding this comment.
Looks great, @pankajastro, thanks a lot for working on and fixing this!
@dwreeves, it took some time, but we finally got the chance to work on this.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
5a0ac3d to
173215c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
closes: #1093 Before Changes <img width="1685" height="978" alt="Screenshot 2026-02-05 at 9 34 35 PM" src="https://github.com/user-attachments/assets/ab924a8c-e81c-4b39-b945-888fbb75fdfc" /> After Changes <img width="1698" height="978" alt="Screenshot 2026-02-05 at 9 29 41 PM" src="https://github.com/user-attachments/assets/37f1837c-5791-4bc9-850a-4489538801f1" /> ---------
**Enhancements** * Change Snowflake profile mappings to default to four threads by @tatiana in #2374 * Refactor to avoid potential future ``UnboundLocalError`` for ``producer_task`` in ``calculate_tasks_map`` by @rin in #2309 **Bug Fixes** * Fix graph selector when using + selector with ``dbt-loom`` by @award1230 in #2389 * Populate ``compiled_sql`` for ``InvocationMode.SUBPROCESS`` in ``ExecutionMode.WATCHER`` by @pankajkoti in #2319 * Preserve ``extra_context`` for watcher consumer task instances by @pankajkoti in #2381 * Fix watcher: respect ``deferrable=False`` from ``operator_args`` on consumer sensor by @pankajkoti in #2384 * Error handle invalid YAML with ``LoadMode.DBT_MANIFEST`` and ``RenderConfig.selector`` by @jonbillings in #2316 * Fix selecting model when it has the same name as folder by @pankajastro in #2328 * Handle Param Validation errors by @tatiana in #2358 * Fix cache swap issue by @jonbillings in #2332 * Fix leaked semaphore warnings in Airflow 3 by resetting dbt adapters by @pankajkoti in #2335 **Docs** * Document ``ExecutionMode.KUBERNETES`` limitations by @tatiana in #2326 **Others** * Add .airflow-registry.yaml for Airflow Provider Registry by @kaxil in #2387 * Improve test coverage for PR #2307 by @tatiana in #2308 * Address feedback from code review #2389 by @evanvolgas in #2394 Closes: astronomer/oss-integrations-private#333
Enhancements * Change Snowflake profile mappings to default to four threads by @tatiana in #2374 * Refactor to avoid potential future ``UnboundLocalError`` for ``producer_task`` in ``calculate_tasks_map`` by @rin in #2309 Bug Fixes * Fix graph selector when using + selector with ``dbt-loom`` by @award1230 in #2389 * Populate ``compiled_sql`` for ``InvocationMode.SUBPROCESS`` in ``ExecutionMode.WATCHER`` by @pankajkoti in #2319 * Preserve ``extra_context`` for watcher consumer task instances by @pankajkoti in #2381 * Fix watcher: respect ``deferrable=False`` from ``operator_args`` on consumer sensor by @pankajkoti in #2384 * Error handle invalid YAML with ``LoadMode.DBT_MANIFEST`` and ``RenderConfig.selector`` by @YourRoyalLinus in #2316 * Fix selecting model when it has the same name as folder by @pankajastro in #2328 * Handle Param Validation errors by @tatiana in #2358 * Fix cache swap issue by @YourRoyalLinus in #2332 * Fix leaked semaphore warnings in Airflow 3 by resetting dbt adapters by @pankajkoti in #2335 Docs * Document ``ExecutionMode.KUBERNETES`` limitations by @tatiana in #2326 Others * Add .airflow-registry.yaml for Airflow Provider Registry by @kaxil in #2387 * Improve test coverage for PR #2307 by @tatiana in #2308 * Address feedback from code review #2389 by @evanvolgas in #2394 Additional details on this change: - The actual release was done from branch 1.13: https://github.com/astronomer/astronomer-cosmos/releases/tag/astronomer-cosmos-v1.13.1 - This PR aims to update our CHANGELOG, and allow us to give credit to the username that was being questioned by codespell
closes: #1093
Before Changes

After Changes
