Skip to content

Ensure local docs operators generate necessary files for datahub integration#655

Closed
chrishronek wants to merge 5 commits into
astronomer:mainfrom
chrishronek:add-dbt-freshness-operator
Closed

Ensure local docs operators generate necessary files for datahub integration#655
chrishronek wants to merge 5 commits into
astronomer:mainfrom
chrishronek:add-dbt-freshness-operator

Conversation

@chrishronek
Copy link
Copy Markdown
Contributor

@chrishronek chrishronek commented Nov 7, 2023

Description

Two changes with this PR:

  1. Add the DbtFreshnessLocalOperator & DbtFreshnessS3LocalOperator to properly generate the sources.json file
  2. Add run_results.json to the list of required files for the DbtDocsLocalOperator.

These files are necessary to use the dbt integration with DataHub and will make it easier for cosmos users to emit their metadata to DataHub as needed.

Checklist

  • I have made corresponding changes to the documentation (if required)
  • I have added tests that prove my fix is effective or that my feature works

@chrishronek chrishronek requested a review from a team as a code owner November 7, 2023 19:28
@chrishronek chrishronek requested a review from a team November 7, 2023 19:28
@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 7, 2023

👷 Deploy Preview for amazing-pothos-a3bca0 processing.

Name Link
🔨 Latest commit 6225db8
🔍 Latest deploy log https://app.netlify.com/sites/amazing-pothos-a3bca0/deploys/654a9a9a7a3d2d0008cbd0e0

@chrishronek chrishronek marked this pull request as ready for review November 7, 2023 20:14
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.

Thanks, @chrishronek ! Very exciting to see these new operators.

I believe not only they can be useful for Datahub integration, but also with the integration to other services and tools (IIR OpenLineage also benefits from the run_results.json file).

Regarding tests, would it be worth to add a unit test related to DbtFreshnessS3LocalOperator? I noticed you added to the example DAG, which runs as part of the integration tests suite. That said, we don't have any test validating what this operator actually does.

I left some minor comments inline.

Comment thread cosmos/operators/local.py
self.base_cmd = ["docs", "generate"]


class DbtFreshnessLocalOperator(DbtLocalBaseOperator):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor comment: what do you think about renaming DbtFreshnessLocalOperator to DbtSourceFreshnessLocalOperator?

Comment thread cosmos/operators/local.py
self.base_cmd = ["source", "freshness"]


class DbtFreshnessS3LocalOperator(DbtFreshnessLocalOperator):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Similar here, I wonder if DbtSourceFreshnessS3LocalOperator would be more representative.

connection_id="test_aws",
bucket_name="test_bucket",
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just realised we're adding the code manually in this doc code.

WDYT if we added a reference to the example DAG, similar to what we did in:

# [START local_example]

.. literalinclude:: ../../dev/dags/basic_cosmos_dag.py
:language: python
:start-after: [START local_example]
:end-before: [END local_example]

This way, the documentation will be up-to-date if the operator changes without additional effort.

bucket_name="test_bucket",
)

generate_dbt_freshness_aws = DbtFreshnessS3Operator(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It may be worth to add a comment on why someone would like to send the source freshness files to S3, and perhaps a link to your blog post: https://parakeet.solutions/ingest-cosmos-dbt-into-datahub/, so people can have more

@tatiana tatiana added this to the 1.3.0 milestone Nov 8, 2023
@arojasb3 arojasb3 mentioned this pull request Nov 9, 2023
2 tasks
@tatiana tatiana added the dbt:docs Primarily related to dbt docs command or functionality label Nov 9, 2023
@tatiana tatiana modified the milestones: 1.3.0, 1.4.0 Dec 7, 2023
@tatiana tatiana added the status:awaiting-author Issue/PR is under discussion and waiting for author's input label Dec 14, 2023
@tatiana tatiana modified the milestones: 1.4.0, 1.5.0 Mar 21, 2024
@tatiana tatiana modified the milestones: 1.5.0, 1.6.0 May 14, 2024
@tatiana tatiana added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Jun 4, 2024
@tatiana
Copy link
Copy Markdown
Collaborator

tatiana commented Jun 6, 2024

@chrishronek, we're starting to close stale PRs - please reopen or create a new one once you have a chance to contribute again!

@tatiana tatiana closed this Jun 6, 2024
@dosubot dosubot Bot removed this from the Cosmos 1.6.0 milestone Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dbt:docs Primarily related to dbt docs command or functionality stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed status:awaiting-author Issue/PR is under discussion and waiting for author's input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants