Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dbt global flags (via dbt_cmd_global_flags in operator_args) #469

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

tatiana
Copy link
Collaborator

@tatiana tatiana commented Aug 15, 2023

Allow users to define dbt_cmd_global_flags inside the operator_args dictionary to set global flags such as --cache-selected-only. These flags will be added between the dbt binary and the dbt subcommand being run.

This PR is not a breaking change since it introduces a new option/parameter.

An alternative implementation would be to hard-code the current 48 dbt (1.6) global flags into Cosmos source code, deciding from within Cosmos which of the flags given to dbt_cmd_flags are global or which are not. This alternative implementation would represent more maintainability to Cosmos developers and is less future-proof to newer versions of dbt.

Closes: #413

Allow users to define dbt_cmd_global_flags inside the operator_args dictionary, to set global flags such as --cache-selected-only.
These flags will be added between the dbt binary and the dbt subcommand being run.

Closes:  #413
@netlify
Copy link

netlify bot commented Aug 15, 2023

👷 Deploy Preview for amazing-pothos-a3bca0 processing.

Name Link
🔨 Latest commit 5d7f4b3
🔍 Latest deploy log https://app.netlify.com/sites/amazing-pothos-a3bca0/deploys/64db69af76413600084969a5

@tatiana tatiana temporarily deployed to internal August 15, 2023 12:04 — with GitHub Actions Inactive
@tatiana tatiana changed the title Support dbt global flags Support dbt global flags (via dbt_cmd_global_flags in operator_args) Aug 15, 2023
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.34% 🎉

Comparison is base (29a9ae9) 91.17% compared to head (5d7f4b3) 91.52%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #469      +/-   ##
==========================================
+ Coverage   91.17%   91.52%   +0.34%     
==========================================
  Files          50       50              
  Lines        1768     1770       +2     
==========================================
+ Hits         1612     1620       +8     
+ Misses        156      150       -6     
Files Changed Coverage Δ
cosmos/operators/base.py 98.90% <100.00%> (+1.14%) ⬆️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tatiana tatiana marked this pull request as ready for review August 15, 2023 12:07
@tatiana tatiana requested a review from a team as a code owner August 15, 2023 12:07
@tatiana tatiana requested a review from a team August 15, 2023 12:07
Copy link
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.

Given that there are many global flags, this makes sense.

@harels
Copy link
Contributor

harels commented Aug 15, 2023

Can we add a followup PR to document this new param?

@tatiana tatiana merged commit b9fdc92 into main Aug 16, 2023
@tatiana tatiana deleted the issue_413 branch August 16, 2023 09:35
tatiana added a commit that referenced this pull request Aug 16, 2023
Feature (pending documentation!)
* Support dbt global flags (via dbt_cmd_global_flags in `operator_args` by @tatiana in #469

Enhancements
* Hide sensitive field when using BigQuery keyfile_dict profile mapping by @jbandoro in #471

Bug fixes
* Fix bug on select node add exclude selector subset ids logic by @jensenity in #463
* Refactor dbt ls to run from a temporary directory, to avoid Read-only file system errors during DAG parsing, by @tatiana in #414

Others
* Docs: Fix RenderConfig load argument by @jbandoro in #466
* Enable CI integration tests from external forks by @tatiana in #458
* Improve CI tests runtime by @tatiana in #457
* Change CI to run coverage after tests pass by @tatiana in #461
* Fix forks code revision in code coverage by @tatiana in #472
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #467"
i
@tatiana tatiana mentioned this pull request Aug 16, 2023
@tatiana tatiana added this to the 1.1.0 milestone Aug 16, 2023
harels pushed a commit that referenced this pull request Sep 6, 2023
Improve documentation on `operator_args`.

This is a follow up to #469 for the 1.1 release.
@tatiana tatiana mentioned this pull request Sep 6, 2023
tatiana added a commit that referenced this pull request Sep 6, 2023
**Features**

* Support dbt global flags (via dbt_cmd_global_flags in operator_args)
by @tatiana in #469
* Support parsing DAGs when there are no connections by @jlaneve in #489

**Enhancements**

* Hide sensitive field when using BigQuery keyfile_dict profile mapping
by @jbandoro in #471
* Consistent Airflow Dataset URIs, inlets and outlets with `Openlineage
package <https://pypi.org/project/openlineage-integration-common/>`_ by
@tatiana in #485. `Read more
<https://astronomer.github.io/astronomer-cosmos/configuration/lineage.html>`_.
* Refactor ``LoadMethod.DBT_LS`` to run from a temporary directory with
symbolic links by @tatiana in #488
* Run ``dbt deps`` when using ``LoadMethod.DBT_LS`` by @DanMawdsleyBA in
#481
* Update Cosmos log color to purple by @harels in #494
* Change operators to log ``dbt`` commands output as opposed to
recording to XCom by @tatiana in #513

**Bug fixes**

* Fix bug on select node add exclude selector subset ids logic by
@jensenity in #463
* Refactor dbt ls to run from a temporary directory, to avoid Read-only
file system errors during DAG parsing, by @tatiana in #414
* Fix profile_config arg in DbtKubernetesBaseOperator by @david-mag in
#505
* Fix SnowflakePrivateKeyPemProfileMapping private_key reference by
@nacpacheco in #501
* Fix incorrect temporary directory creation in VirtualenvOperator init
by @tatiana in #500
* Fix log propagation issue by @tatiana in #498
* Fix PostgresUserPasswordProfileMapping to retrieve port from
connection by @jlneve in #511

**Others**

* Docs: Fix RenderConfig load argument by @jbandoro in #466
* Enable CI integration tests from external forks by @tatiana in #458
* Improve CI tests runtime by @tatiana in #457
* Change CI to run coverage after tests pass by @tatiana in #461
* Fix forks code revision in code coverage by @tatiana in #472
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #467
* Drop support to Python 3.7 in the CI test matrix by @harels in #490
* Add Airflow 2.7 to the CI test matrix by @tatiana in #487
* Add MyPy type checks to CI since we exceeded pre-commit disk quota
usage by @tatiana in #510
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error when using cache_selected_only set to True
2 participants