Skip to content

Commit

Permalink
fix(ingest/dbt): Adding fix if dbt data type is null (datahub-project…
Browse files Browse the repository at this point in the history
  • Loading branch information
treff7es authored May 9, 2024
1 parent e2e8434 commit 27d0b92
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
29 changes: 17 additions & 12 deletions metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,17 @@ def make_mapping_upstream_lineage(


def get_column_type(
report: DBTSourceReport, dataset_name: str, column_type: str, dbt_adapter: str
report: DBTSourceReport,
dataset_name: str,
column_type: Optional[str],
dbt_adapter: str,
) -> SchemaFieldDataType:
"""
Maps known DBT types to datahub types
"""
TypeClass: Any = _field_type_mapping.get(column_type)
TypeClass: Any = _field_type_mapping.get(column_type) if column_type else None

if TypeClass is None:
if TypeClass is None and column_type:
# resolve a modified type
if dbt_adapter == "trino":
TypeClass = resolve_trino_modified_type(column_type)
Expand Down Expand Up @@ -934,12 +937,14 @@ def get_workunit_processors(self) -> List[Optional[MetadataWorkUnitProcessor]]:
def _make_data_platform_instance_aspect(self) -> DataPlatformInstanceClass:
return DataPlatformInstanceClass(
platform=mce_builder.make_data_platform_urn(DBT_PLATFORM),
instance=mce_builder.make_dataplatform_instance_urn(
mce_builder.make_data_platform_urn(DBT_PLATFORM),
self.config.platform_instance,
)
if self.config.platform_instance
else None,
instance=(
mce_builder.make_dataplatform_instance_urn(
mce_builder.make_data_platform_urn(DBT_PLATFORM),
self.config.platform_instance,
)
if self.config.platform_instance
else None
),
)

def get_workunits_internal(self) -> Iterable[MetadataWorkUnit]:
Expand Down Expand Up @@ -1809,9 +1814,9 @@ def _translate_dbt_name_to_upstream_urn(dbt_name: str) -> str:
)
for upstream in upstream_urns
],
fineGrainedLineages=(cll or None)
if self.config.include_column_lineage
else None,
fineGrainedLineages=(
(cll or None) if self.config.include_column_lineage else None
),
)

# This method attempts to read-modify and return the owners of a dataset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"regtype": None,
"regrole": None,
"regnamespace": None,
"super": None,
"uuid": StringType,
"pg_lsn": None,
"tsvector": None, # text search vector
Expand Down

0 comments on commit 27d0b92

Please sign in to comment.