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
base: main
Are you sure you want to change the base?
Ensure local docs operators generate necessary files for datahub integration #655
Conversation
👷 Deploy Preview for amazing-pothos-a3bca0 processing.
|
There was a problem hiding this 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): |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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", | ||
) | ||
|
There was a problem hiding this comment.
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] |
astronomer-cosmos/docs/getting_started/execution-modes.rst
Lines 58 to 61 in 188fe56
.. 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( |
There was a problem hiding this comment.
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
Description
Two changes with this PR:
DbtFreshnessLocalOperator
&DbtFreshnessS3LocalOperator
to properly generate the sources.json fileDbtDocsLocalOperator
.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