mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-27 15:38:43 +00:00
fixed dbt runresults ts (#14572)
This commit is contained in:
parent
89d35c0a4b
commit
7fdff15648
@ -14,6 +14,8 @@ Constants required for dbt
|
||||
|
||||
from enum import Enum
|
||||
|
||||
DBT_RUN_RESULT_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
|
||||
|
||||
# Based on https://schemas.getdbt.com/dbt/manifest/v7/index.html
|
||||
REQUIRED_MANIFEST_KEYS = ["name", "schema", "resource_type"]
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
DBT source methods.
|
||||
"""
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from typing import Iterable, List, Optional, Union
|
||||
|
||||
from metadata.generated.schema.api.lineage.addLineage import AddLineageRequest
|
||||
@ -59,6 +60,7 @@ from metadata.ingestion.ometa.ometa_api import OpenMetadata
|
||||
from metadata.ingestion.source.database.column_type_parser import ColumnTypeParser
|
||||
from metadata.ingestion.source.database.database_service import DataModelLink
|
||||
from metadata.ingestion.source.database.dbt.constants import (
|
||||
DBT_RUN_RESULT_DATE_FORMAT,
|
||||
REQUIRED_CATALOG_KEYS,
|
||||
REQUIRED_MANIFEST_KEYS,
|
||||
DbtCommonEnum,
|
||||
@ -857,12 +859,21 @@ class DbtSource(DbtServiceSource):
|
||||
dbt_test_completed_at = dbt_test_timing.completed_at
|
||||
dbt_timestamp = None
|
||||
if dbt_test_completed_at:
|
||||
dbt_timestamp = dbt_test_completed_at.timestamp()
|
||||
dbt_timestamp = dbt_test_completed_at
|
||||
elif self.context.run_results_generate_time:
|
||||
dbt_timestamp = self.context.run_results_generate_time.timestamp()
|
||||
dbt_timestamp = self.context.run_results_generate_time
|
||||
|
||||
# check if the timestamp is a str type and convert accordingly
|
||||
if isinstance(dbt_timestamp, str):
|
||||
dbt_timestamp = datetime.strptime(
|
||||
dbt_timestamp, DBT_RUN_RESULT_DATE_FORMAT
|
||||
)
|
||||
|
||||
# Create the test case result object
|
||||
test_case_result = TestCaseResult(
|
||||
timestamp=convert_timestamp_to_milliseconds(dbt_timestamp),
|
||||
timestamp=convert_timestamp_to_milliseconds(
|
||||
dbt_timestamp.timestamp()
|
||||
),
|
||||
testCaseStatus=test_case_status,
|
||||
testResultValue=[
|
||||
TestResultValue(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user