Skip to content

Fix the async execution mode read sql files for dbt packages#1588

Merged
tatiana merged 9 commits into
mainfrom
fix_read_path
Mar 12, 2025
Merged

Fix the async execution mode read sql files for dbt packages#1588
tatiana merged 9 commits into
mainfrom
fix_read_path

Conversation

@pankajastro
Copy link
Copy Markdown
Contributor

@pankajastro pankajastro commented Mar 4, 2025

closes: #1585

This PR modifies the DbtNode to include the packages,
allowing us to correctly construct the path when reading
the generated SQL files. In DBT projects with dbt_packages,
the dbt run command generates SQL files within the respective
dbt_packages folder inside the target/run directory, instead of
the main project folder.

Screenshot 2025-03-06 at 12 01 51 AM

With Setup task

Screenshot 2025-03-06 at 12 02 58 AM

Without Setup task

Screenshot 2025-03-06 at 12 03 34 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

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

Deploying astronomer-cosmos with  Cloudflare Pages  Cloudflare Pages

Latest commit: 43da5c7
Status: ✅  Deploy successful!
Preview URL: https://c1206954.astronomer-cosmos.pages.dev
Branch Preview URL: https://fix-read-path.astronomer-cosmos.pages.dev

View logs

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 4, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.46%. Comparing base (b04717c) to head (43da5c7).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1588      +/-   ##
==========================================
+ Coverage   97.36%   97.46%   +0.10%     
==========================================
  Files          80       80              
  Lines        4934     4937       +3     
==========================================
+ Hits         4804     4812       +8     
+ Misses        130      125       -5     

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

@pankajastro pankajastro marked this pull request as ready for review March 5, 2025 18:34
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. area:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc dbt:run Primarily related to dbt run command or functionality labels Mar 5, 2025
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.

Hi @pankajastro , this is looking great, thank you very much!
Please, cover the areas that Codecov reported are lacking tests.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Mar 11, 2025
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.

Great work! Thank you very much for fixing this customer issue, @pankajastro!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 12, 2025
@tatiana tatiana merged commit b309dac into main Mar 12, 2025
@tatiana tatiana deleted the fix_read_path branch March 12, 2025 14:03
pankajkoti pushed a commit that referenced this pull request Mar 13, 2025
closes: #1585

This PR modifies the DbtNode to include the packages,
allowing us to correctly construct the path when reading
the generated SQL files. In DBT projects with dbt_packages,
the dbt run command generates SQL files within the respective
dbt_packages folder inside the target/run directory, instead of
the main project folder.

<img width="1667" alt="Screenshot 2025-03-06 at 12 01 51 AM"
src="https://github.com/user-attachments/assets/911e0859-327f-49bf-a081-4da7003d7817"
/>

**With Setup task**

<img width="1687" alt="Screenshot 2025-03-06 at 12 02 58 AM"
src="https://github.com/user-attachments/assets/c3c1f066-b19f-4bdd-9358-779845a32f8b"
/>

**Without Setup task**

<img width="1688" alt="Screenshot 2025-03-06 at 12 03 34 AM"
src="https://github.com/user-attachments/assets/b0bb21bd-e0d1-45a4-90ea-cb4857630318"
/>

(cherry picked from commit b309dac)
@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:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc dbt:run Primarily related to dbt run command or functionality lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ASYNC execution mode "No such file or directory" while reading generated SQL from target folder

2 participants