Skip to content

Fix selecting model when it has the same name as folder#2328

Merged
pankajastro merged 2 commits into
mainfrom
add_fqn_select
Feb 16, 2026
Merged

Fix selecting model when it has the same name as folder#2328
pankajastro merged 2 commits into
mainfrom
add_fqn_select

Conversation

@pankajastro
Copy link
Copy Markdown
Contributor

@pankajastro pankajastro commented Feb 5, 2026

closes: #1093

Before Changes
Screenshot 2026-02-05 at 9 34 35 PM

After Changes
Screenshot 2026-02-05 at 9 29 41 PM

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 5, 2026

Deploy Preview for astronomer-cosmos canceled.

Name Link
🔨 Latest commit fbaeb3c
🔍 Latest deploy log https://app.netlify.com/projects/astronomer-cosmos/deploys/69921b6472f90e0008cc70f0

Comment thread cosmos/dbt/graph.py Outdated
Comment thread cosmos/dbt/graph.py Outdated
Comment thread cosmos/dbt/graph.py Outdated
Comment thread cosmos/dbt/selector.py Outdated
Comment thread cosmos/airflow/graph.py Outdated
Comment thread cosmos/airflow/graph.py Outdated
Comment thread cosmos/dbt/selector.py
@pankajastro pankajastro marked this pull request as ready for review February 15, 2026 19:16
Copilot AI review requested due to automatic review settings February 15, 2026 19:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fqn to DbtNode and populate it from both dbt ls output and manifest.json.
  • Generate dbt task commands using --select fqn:... when fqn is present.
  • Update unit/integration tests to expect the new selection syntax and updated dbt ls argument 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.

Comment thread cosmos/dbt/graph.py
Comment thread tests/test_converter.py Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.91%. Comparing base (a6c7dd7) to head (fbaeb3c).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@tatiana tatiana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@tatiana tatiana changed the title Add fqn select method Fix selecting model when it has the same name as folder Feb 16, 2026
@tatiana tatiana added this to the Cosmos 1.13.1 milestone Feb 16, 2026
Copilot AI review requested due to automatic review settings February 16, 2026 13:30
pankajastro and others added 2 commits February 16, 2026 19:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@pankajastro pankajastro merged commit d10c4c0 into main Feb 16, 2026
71 checks passed
@pankajastro pankajastro deleted the add_fqn_select branch February 16, 2026 13:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

tatiana pushed a commit that referenced this pull request Feb 20, 2026
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"
/>

---------
@tatiana tatiana mentioned this pull request Feb 20, 2026
pankajastro added a commit that referenced this pull request Feb 21, 2026
Document the `fqn` include/exclude option introduced in PR:
#2328 and
#2375
@tatiana tatiana modified the milestones: Cosmos 1.13.1, Cosmos 1.14.0 Feb 25, 2026
@tatiana tatiana modified the milestones: Cosmos 1.14.0, Cosmos 1.13.1 Feb 25, 2026
tatiana added a commit that referenced this pull request Feb 25, 2026
**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
@tatiana tatiana mentioned this pull request Feb 25, 2026
tatiana added a commit that referenced this pull request Feb 25, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Cosmos dbt run inside DbtDag/DbtTaskGroup can select multiple nodes

3 participants