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

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

chrishronek
Copy link
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 review from a team as code owners November 7, 2023 19:28
Copy link

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
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.


def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
self.base_cmd = ["docs", "generate"]


class DbtFreshnessLocalOperator(DbtLocalBaseOperator):
Copy link
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?

self.base_cmd = ["source", "freshness"]


class DbtFreshnessS3LocalOperator(DbtFreshnessLocalOperator):
Copy link
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
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.

@@ -41,6 +42,15 @@ You can use the :class:`~cosmos.operators.DbtDocsS3Operator` to generate and upl
bucket_name="test_bucket",
)

generate_dbt_freshness_aws = DbtFreshnessS3Operator(
Copy link
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
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 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.

None yet

2 participants