Skip to content

Commit

Permalink
openlineage: Add documentation facet when translating from Table entity
Browse files Browse the repository at this point in the history
Signed-off-by: Kacper Muda <[email protected]>
  • Loading branch information
kacpermuda committed Jul 12, 2024
1 parent 370ad21 commit e994960
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions airflow/providers/openlineage/extractors/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def convert_to_ol_dataset_from_object_storage_uri(uri: str) -> Dataset | None:
def convert_to_ol_dataset_from_table(table: Table) -> Dataset:
from openlineage.client.facet import (
BaseFacet,
DocumentationDatasetFacet,
OwnershipDatasetFacet,
OwnershipDatasetFacetOwners,
SchemaDatasetFacet,
Expand Down Expand Up @@ -231,6 +232,8 @@ def convert_to_ol_dataset_from_table(table: Table) -> Dataset:
for user in table.owners
]
)
if table.description:
facets["documentation"] = DocumentationDatasetFacet(description=table.description)
return Dataset(
namespace=f"{table.cluster}",
name=f"{table.database}.{table.name}",
Expand Down
3 changes: 3 additions & 0 deletions tests/providers/openlineage/extractors/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import pytest
from openlineage.client.facet import (
DocumentationDatasetFacet,
OwnershipDatasetFacet,
OwnershipDatasetFacetOwners,
SchemaDatasetFacet,
Expand Down Expand Up @@ -94,6 +95,7 @@ def test_convert_to_ol_dataset_from_table_with_columns_and_owners():
User(email="[email protected]", last_name="Smith"),
User(email="[email protected]"),
],
description="test description",
)
expected_facets = {
"schema": SchemaDatasetFacet(
Expand All @@ -118,6 +120,7 @@ def test_convert_to_ol_dataset_from_table_with_columns_and_owners():
OwnershipDatasetFacetOwners(name="user:<[email protected]>", type=""),
]
),
"documentation": DocumentationDatasetFacet(description="test description"),
}
result = ExtractorManager.convert_to_ol_dataset_from_table(table)
assert result.namespace == "c1"
Expand Down

0 comments on commit e994960

Please sign in to comment.