Skip to content

Release 1.2.4#676

Merged
tatiana merged 6 commits into
release-1.2from
release-1.2.4
Nov 15, 2023
Merged

Release 1.2.4#676
tatiana merged 6 commits into
release-1.2from
release-1.2.4

Conversation

@tatiana
Copy link
Copy Markdown
Collaborator

@tatiana tatiana commented Nov 15, 2023

Bug fixes

Others

joppevos and others added 6 commits November 14, 2023 17:09
…AL` (#659)

Extends the local operator when running `dbt deps` with the provides
profile flags.

This makes the logic consistent between DAG parsing and task running as
referenced below

https://github.com/astronomer/astronomer-cosmos/blob/8e2d5908ce89aa98813af6dfd112239e124bd69a/cosmos/dbt/graph.py#L247-L266

Closes: #658
(cherry picked from commit 6e41471)
Since Cosmos 1.2.2 users who used `ExecutionMode.DBT_LS` (directly or
via `ExecutionMode.AUTOMATIC`) and set
`ExecutionConfig.dbt_executable_path` (most, if not all, Astro CLI
users), like:

```
execution_config = ExecutionConfig(
    dbt_executable_path = f"{os.environ['AIRFLOW_HOME']}/dbt_venv/bin/dbt",
)
```

Started facing the issue:
```
Broken DAG: [/usr/local/airflow/dags/my_example.py] Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/cosmos/dbt/graph.py", line 178, in load
    self.load_via_dbt_ls()
  File "/usr/local/lib/python3.11/site-packages/cosmos/dbt/graph.py", line 233, in load_via_dbt_ls
    raise CosmosLoadDbtException(f"Unable to find the dbt executable: {self.dbt_cmd}")
cosmos.dbt.graph.CosmosLoadDbtException: Unable to find the dbt executable: dbt
```

This issue was initially reported in the Airflow #airflow-astronomer
Slack channel:
https://apache-airflow.slack.com/archives/C03T0AVNA6A/p1699584315506629

The workaround to avoid this error in Cosmos 1.2.2 and 1.2.3 is to set
the `dbt_executable_path` in the `RenderConfig`:
```
render_config=RenderConfig(dbt_executable_path = f"{os.environ['AIRFLOW_HOME']}/dbt_venv/bin/dbt",),
```

This PR solves the bug from Cosmos 1.2.4 onwards.

(cherry picked from commit 2b61364)
#660)

This PR refactors the `create_symlinks` function that was previously
used in load via dbt ls so that it can be used in
`DbtLocalBaseOperator.run_command` instead of copying the entire
directory.

Closes: #614
(cherry picked from commit 5d23758)
Update `DbtLocalBaseOperator` code to store `compiled_sql` prior to
exception handling so that when a task fails, the `compiled_sql` can still
be reviewed.

In the process found and fixed a related bug where `compiled_sql` was
being dropped on some operations due to the way that the `full_refresh`
field was being added to the `template_fields`.

Closes #369

Fixes bug introduced in
#623 where
compiled_sql was being lost in `DbtSeedLocalOperator` and
`DbtRunLocalOperator`

Co-authored-by: Andrew Greenburg <agreenburg@vergeventures.net>
(cherry picked from commit ee91ece)
Add execution config to MWAA code example document.

Closes: #667
(cherry picked from commit 773fa27)
Bug fixes

* Store `compiled_sql` even when task fails by @agreenburg in #671
* Refactor `LoadMethod.LOCAL` to use symlinks instead of copying directory by @jbandoro in #660
* Fix 'Unable to find the dbt executable: dbt' error by @tatiana in #666
* Fix installing deps when using `profile_mapping` & `ExecutionMode.LOCAL` by @joppevos in #659

Others

* Docs fix: add execution config to MWAA code example by @ugmuka in #674
@tatiana tatiana requested a review from a team as a code owner November 15, 2023 15:04
@tatiana tatiana requested a review from a team November 15, 2023 15:04
@dosubot dosubot Bot added area:execution Related to the execution environment/mode, like Docker, Kubernetes, Local, VirtualEnv, etc dbt:run Primarily related to dbt run command or functionality execution:local Related to Local execution environment priority:high High priority issues are blocking or critical issues without a workaround and large impact labels Nov 15, 2023
Copy link
Copy Markdown
Contributor

@harels harels left a comment

Choose a reason for hiding this comment

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

🚢

@tatiana tatiana merged commit 63a5516 into release-1.2 Nov 15, 2023
@tatiana tatiana deleted the release-1.2.4 branch November 15, 2023 15:21
@tatiana tatiana added this to the 1.2.4 milestone Nov 16, 2023
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 execution:local Related to Local execution environment priority:high High priority issues are blocking or critical issues without a workaround and large impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants