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

Add deferrable mode to DbtCloudRunJobOperator #29014

Merged
merged 4 commits into from Jan 23, 2023
Merged

Conversation

phanikumv
Copy link
Contributor

This PR donates the DbtCloudRunJobOperatorAsync from astronomer-providers repo


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

Comment on lines +134 to +139
def provide_account_id(func: T) -> T:
"""
Decorator which provides a fallback value for ``account_id``. If the ``account_id`` is None or not passed
to the decorated function, the value will be taken from the configured dbt Cloud Airflow Connection.
"""
function_signature = signature(func)
Copy link
Contributor

Choose a reason for hiding this comment

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

The problem with this wrapper (as well as other same decorators which already exists in community providers) that every time we access to method which decorated by this function we need to lookup for connection in Secrets Backend (if configured), Environment Variables and Airflow Database.

Is any way to make it cashable? Something like that: #28716

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check if it can be made cacheable

airflow/providers/dbt/cloud/operators/dbt.py Outdated Show resolved Hide resolved
@phanikumv phanikumv force-pushed the dbt_async branch 3 times, most recently from 165ea0c to 834bb09 Compare January 19, 2023 08:29
@phanikumv phanikumv marked this pull request as ready for review January 19, 2023 08:29
Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

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

Let's do caching in a separate PR

@kaxil kaxil merged commit 55049c5 into apache:main Jan 23, 2023
@kaxil kaxil deleted the dbt_async branch January 23, 2023 12:06
josh-fell added a commit to josh-fell/airflow that referenced this pull request Feb 2, 2023
Related: apache#28890 apache#29014

There was a recent enhancement of DbtCloudRunJobOperator to include deferrable/async functionality. Unfortunately the `tenant` evaluation in the DbtCloudHook was outdated and didn't include the most recent change to properly handle domain specification.

This PR consolidates the tenant eval logic to a common method to be used by both sync and async methods in the hook.
josh-fell added a commit that referenced this pull request Feb 2, 2023
* Correct tenant eval within async logic of DbtCloudHook

Related: #28890 #29014

There was a recent enhancement of DbtCloudRunJobOperator to include deferrable/async functionality. Unfortunately the `tenant` evaluation in the DbtCloudHook was outdated and didn't include the most recent change to properly handle domain specification.

This PR consolidates the tenant eval logic to a common method to be used by both sync and async methods in the hook.

* Remove Connection.schema use

* Update provider.yaml and changelog
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.

None yet

3 participants