docs(ingest): fix error in custom tags transformer example (#6767)

This commit is contained in:
Harshal Sheth 2022-12-15 18:31:12 -05:00 committed by GitHub
parent 1350bb010c
commit 798d82fe60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -309,22 +309,11 @@ import logging
import datahub.emitter.mce_builder as builder import datahub.emitter.mce_builder as builder
from datahub.metadata.schema_classes import ( from datahub.metadata.schema_classes import (
DatasetSnapshotClass,
TagAssociationClass TagAssociationClass
) )
def custom_tags(current: DatasetSnapshotClass) -> List[TagAssociationClass]: def custom_tags(entity_urn: str) -> List[TagAssociationClass]:
""" Returns tags to associate to a dataset depending on custom logic """Compute the tags to associate to a given dataset."""
This function receives a DatasetSnapshotClass, performs custom logic and returns
a list of TagAssociationClass-wrapped tags.
Args:
current (DatasetSnapshotClass): Single DatasetSnapshotClass object
Returns:
List of TagAssociationClass objects.
"""
tag_strings = [] tag_strings = []
@ -335,7 +324,7 @@ def custom_tags(current: DatasetSnapshotClass) -> List[TagAssociationClass]:
tag_strings = [builder.make_tag_urn(tag=n) for n in tag_strings] tag_strings = [builder.make_tag_urn(tag=n) for n in tag_strings]
tags = [TagAssociationClass(tag=tag) for tag in tag_strings] tags = [TagAssociationClass(tag=tag) for tag in tag_strings]
logging.info(f"Tagging dataset {current.urn} with {tag_strings}.") logging.info(f"Tagging dataset {entity_urn} with {tag_strings}.")
return tags return tags
``` ```
Finally, you can install and use your custom transformer as [shown here](#installing-the-package). Finally, you can install and use your custom transformer as [shown here](#installing-the-package).