Skip to content

Fix select behaviour using LoadMode.MANIFEST and a path with star#1602

Merged
tatiana merged 2 commits into
mainfrom
fix-select-path-wtih-star
Mar 13, 2025
Merged

Fix select behaviour using LoadMode.MANIFEST and a path with star#1602
tatiana merged 2 commits into
mainfrom
fix-select-path-wtih-star

Conversation

@tatiana
Copy link
Copy Markdown
Collaborator

@tatiana tatiana commented Mar 13, 2025

Let's say the dbt project has a file_path "gen2/models/parent.sql"

parent_node = DbtNode(
    unique_id=f"{DbtResourceType.MODEL.value}.{SAMPLE_PROJ_PATH.stem}.parent",
    resource_type=DbtResourceType.MODEL,
    depends_on=[grandparent_node.unique_id, another_grandparent_node.unique_id],
    file_path=SAMPLE_PROJ_PATH / "gen2/models/parent.sql",
    tags=["has_child", "is_child"],
    config={"materialized": "view", "tags": ["has_child", "is_child"]},
)

When using Cosmos 1.9.0 with LoadMode.MANIFEST and trying to use:

RenderConfig(select="gen2/models/*")

The selector would not return any results.

It would still work with LoadMode.DBT_LS.

The goal of this PR is to solve this issue.

Let's say the dbt project has a file_path "gen2/models/parent.sql"
```
parent_node = DbtNode(
    unique_id=f"{DbtResourceType.MODEL.value}.{SAMPLE_PROJ_PATH.stem}.parent",
    resource_type=DbtResourceType.MODEL,
    depends_on=[grandparent_node.unique_id, another_grandparent_node.unique_id],
    file_path=SAMPLE_PROJ_PATH / "gen2/models/parent.sql",
    tags=["has_child", "is_child"],
    config={"materialized": "view", "tags": ["has_child", "is_child"]},
)
```

When using Cosmos 1.9.0 with `LoadMode.MANIFEST` and trying to use:

```
RenderConfig(select="gen2/models/*")
```

The selector would not return any results.

It would still work with `LoadMode.DBT_LS`.

The goal with this PR is to solve this issue.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 13, 2025

Deploying astronomer-cosmos with  Cloudflare Pages  Cloudflare Pages

Latest commit: 146f436
Status: ✅  Deploy successful!
Preview URL: https://51c1d303.astronomer-cosmos.pages.dev
Branch Preview URL: https://fix-select-path-wtih-star.astronomer-cosmos.pages.dev

View logs

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 13, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 13, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit a573179
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/67d283136d8275000847322c

@tatiana tatiana added customer request An Astronomer customer made requested this parsing:dbt_manifest Issues, questions, or features related to dbt_manifest parsing area:selector Related to selector, like DAG selector, DBT selector, etc labels Mar 13, 2025
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 13, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit 146f436
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/67d2831d662a66000820312d

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.40%. Comparing base (09bcb55) to head (146f436).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1602      +/-   ##
==========================================
+ Coverage   94.70%   97.40%   +2.70%     
==========================================
  Files          80       80              
  Lines        4944     4942       -2     
==========================================
+ Hits         4682     4814     +132     
+ Misses        262      128     -134     

☔ 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.

tatiana added a commit that referenced this pull request Mar 13, 2025
Makes sure the fixes:
- Fix path selector when manifest.json was created in MS Windows (#1601)
- Fix select behaviour using LoadMode.MANIFEST and a path with star (#1602)

Work from an end-to-end perspective, solving Astro customer's original issue.
Comment thread cosmos/dbt/selector.py
@tatiana tatiana added this to the Cosmos 1.9.1 milestone Mar 13, 2025
Copy link
Copy Markdown
Contributor

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

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

LGTM

@tatiana tatiana merged commit 0e1f81b into main Mar 13, 2025
@tatiana tatiana deleted the fix-select-path-wtih-star branch March 13, 2025 12:05
tatiana added a commit that referenced this pull request Mar 13, 2025
Makes sure the fixes:
- Fix path selector when manifest.json was created in MS Windows (#1601)
- Fix select behaviour using LoadMode.MANIFEST and a path with star
(#1602)

Work from an end-to-end perspective, solving Astro customer's original
issue.
pankajkoti pushed a commit that referenced this pull request Mar 13, 2025
…1602)

Let's say the dbt project has a file_path "gen2/models/parent.sql"
```
parent_node = DbtNode(
    unique_id=f"{DbtResourceType.MODEL.value}.{SAMPLE_PROJ_PATH.stem}.parent",
    resource_type=DbtResourceType.MODEL,
    depends_on=[grandparent_node.unique_id, another_grandparent_node.unique_id],
    file_path=SAMPLE_PROJ_PATH / "gen2/models/parent.sql",
    tags=["has_child", "is_child"],
    config={"materialized": "view", "tags": ["has_child", "is_child"]},
)
```

When using Cosmos 1.9.0 with `LoadMode.MANIFEST` and trying to use:

```
RenderConfig(select="gen2/models/*")
```

The selector would not return any results.

It would still work with `LoadMode.DBT_LS`.

The goal of this PR is to solve this issue.

(cherry picked from commit 0e1f81b)
pankajkoti pushed a commit that referenced this pull request Mar 13, 2025
Makes sure the fixes:
- Fix path selector when manifest.json was created in MS Windows (#1601)
- Fix select behaviour using LoadMode.MANIFEST and a path with star
(#1602)

Work from an end-to-end perspective, solving Astro customer's original
issue.

(cherry picked from commit 3138892)
@pankajkoti pankajkoti mentioned this pull request Mar 13, 2025
@tatiana tatiana mentioned this pull request Mar 13, 2025
tatiana added a commit that referenced this pull request Mar 17, 2025
Bug Fixes

* Fix import error in dbt bigquery adapter mock for ``dbt-bigquery<1.8``
for ``ExecutionMode.AIRFLOW_ASYNC`` by @pankajkoti in #1548
* Fix ``operator_args`` override configuration by @ghjklw in #1558
* Fix missing ``install_dbt_deps`` in ``ProjectConfig`` ``__init__``
method by @ghjklw in #1556
* Fix dbt project parsing ``dbt_vars`` behavior passed via
``operator_args`` by @AlexandrKhabarov in #1543
* Avoid reading the connection during DAG parsing of the async BigQuery
operator by @joppevos in #1582
* Fix: Workaround to incorrectly raised ``gcsfs.retry.HttpError``
(Invalid Credentials, 401) by @tatiana in #1598
* Fix the async execution mode read sql files for dbt packages by
@pankajastro in #1588
* Improve BQ async error handling by @tatiana in #1597
* Fix path selector when ``manifest.json`` is created using MS Windows
by @tatiana in #1601
* Fix log that prints 'Total filtered nodes' by @tatiana in #1603
* Fix select behaviour using ``LoadMode.MANIFEST`` and a path with star
by @tatiana in #1602
* Support ``on_warning_callback`` with ``TestBehavior.BUILD`` and
``ExecutionMode.LOCAL`` by @corsettigyg in #1571
* Fix ``DbtRunLocalOperator.partial()`` support by @tatiana @ashb in
#1609
* fix: ``container_name`` is null for ecs integration by @nicor88 in
#1592

Docs

* Improve MWAA getting-started docs by removing unused imports by
@jx2lee in #1562

Others

* Disable ``example_cosmos_dbt_build.py`` DAG in CI by @pankajastro in
#1567
* Upgrade GitHub Actions Ubuntu version by @tatiana in #1561
* Update GitHub bug issue template by @pankajastro in #1586
* Enable DAG ``example_cosmos_dbt_build.py`` in CI by @pankajastro in
#1573
* Run async DAG in DAG without setup/teardown task by @pankajastro in
#1599
* Add test case that fully covers recent select issue by @tatiana in
#1604
* Add CI job to test multiple dbt versions for the async DAG by
@pankajkoti in #1535
* Improve unit tests speed from 89s to 14s by @tatiana in #1600
* Pre-commit updates: #1560, #1583, #1596


Closes: #1550

Mergeable version of
#1607

Co-authored-by: Pankaj Singh
<98807258+pankajastro@users.noreply.github.com>
Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:selector Related to selector, like DAG selector, DBT selector, etc customer request An Astronomer customer made requested this parsing:dbt_manifest Issues, questions, or features related to dbt_manifest parsing size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants