-
Notifications
You must be signed in to change notification settings - Fork 186
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 default behaviour for converting dbt Source nodes into Airflow tasks #630
Comments
In addition to freshness checks users can also (and sometimes do) add standard tests to their sources, i.e. One small note, DummyOperator has been deprecated in favour of EmptyOperator in Airflow 2.4 (see here). |
Hi, @tatiana, I'm Dosu, and I'm helping the Cosmos team manage their backlog. I wanted to let you know that I'll be marking this issue as stale. From what I understand, the issue you raised pertains to the default rendering of dbt Source nodes as Airflow tasks in Cosmos 1.2.1, and there's a discussion about the need for default behavior considering the customization options introduced in Cosmos 1.2.0. Additionally, there's a suggestion to display sources as tasks in the Airflow UI and a mention of the deprecation of DummyOperator in favor of EmptyOperator in Airflow 2.4. Could you please confirm if this issue is still relevant to the latest version of the Cosmos repository? If it is, please let the Cosmos team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you for your understanding, and please don't hesitate to reach out if you have any questions or need further assistance. Best, |
+1 to this issue as this is something I'm interested in.
I'm in support for having each source render as an Airflow task, and running all tests attached to it. This improves the visibility of a source and whether a model update failure is due to an upstream failure.
This command should run all the tests associated to a source. I'm not sure how we should handle Add on questions: |
@tatiana, could you please help with this issue? The user has indicated that the issue is still relevant and has provided additional context and questions. Thank you!
|
Re-Opening of PR #661 This PR features a new way of rendering source nodes: - Check freshness for sources with freshness checks - Source tests - Empty operators for nodes without tests or freshness. One of the main limitations I found while using the `custom_callback` functions on source nodes to check freshness is that nodes were being created on 100% of sources but not all of them required freshness checks, this made workers waste compute time. I'm adding a new variable into the DbtNode class called has_freshness which would be True for sources with freshness checks and False for any other resource type. If this feature is enabled with the option `ALL`: All sources with the has_freshness == False will be rendered as Empty Operators, to keep the dbt's behavior of showing sources as suggested in issue #630 <!-- Add a brief but complete description of the change. --> A new rendered template field is included too: `freshness` which is the sources.json generated by dbt when running `dbt source freshness` This adds a new node type (source), which changes some tests behavior. This PR also updates the dev dbt project jaffle_shop to include source nodes when enabled. ![image](https://github.com/user-attachments/assets/e972ac58-8741-4c13-9905-e78775f9cc80) As seen in the image, source nodes with freshness checks are rendered with a blue color, while the ones rendered as EmptyOperator show a white/light green color Closes: #630 Closes: #572 Closes: #875 <!-- If this PR closes an issue, you can use a keyword to auto-close. --> <!-- i.e. "closes #0000" --> This won't be a breaking change since the default behavior will still be ignoring this new feature. That can be changed with the new RenderConfig variable called `source_rendering_behavior`. Co-authored-by: Pankaj <pankaj.singh@astronomer.io> Co-authored-by: Pankaj Singh <98807258+pankajastro@users.noreply.github.com>
As of Cosmos 1.2.1, it does not render dbt Source nodes as Airflow tasks by default.
Since Cosmos 1.2.0, we've introduced support for customizing how the library converts any dbt node into Airflow:
https://astronomer.github.io/astronomer-cosmos/configuration/render-config.html#customizing-how-nodes-are-rendered-experimental
This means users can already customise the desired behaviour for Source nodes, using something like:
astronomer-cosmos/dev/dags/example_cosmos_sources.py
Line 63 in 11ce2d7
The open questions are:
The text was updated successfully, but these errors were encountered: