From da6da45373ca7f791ca409e2a1d4ece48bf280a9 Mon Sep 17 00:00:00 2001 From: Imri Paran Date: Fri, 5 Jul 2024 12:21:43 +0200 Subject: [PATCH] MINOR: fix bigquery profiler (#16933) * fix: bigquery profiler cast creation_time from __TABLES__ to datetime * format * removed comment * format --- .../metadata/profiler/orm/functions/table_metric_computer.py | 3 +-- ingestion/src/metadata/profiler/processor/core.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py b/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py index cbe625907be..ba284e21165 100644 --- a/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py +++ b/ingestion/src/metadata/profiler/orm/functions/table_metric_computer.py @@ -324,7 +324,7 @@ class BigQueryTableMetricComputer(BaseTableMetricComputer): columns = [ Column("row_count").label("rowCount"), Column("size_bytes").label("sizeInBytes"), - Column("creation_time").label("createDateTime"), + func.TIMESTAMP_MILLIS(Column("creation_time")).label(CREATE_DATETIME), *self._get_col_names_and_count(), ] where_clause = [ @@ -333,7 +333,6 @@ class BigQueryTableMetricComputer(BaseTableMetricComputer): Column("dataset_id") == self.schema_name, Column("table_id") == self.table_name, ] - query = self._build_query( columns, self._build_table( diff --git a/ingestion/src/metadata/profiler/processor/core.py b/ingestion/src/metadata/profiler/processor/core.py index c77c14a04aa..6f7ff6d4d02 100644 --- a/ingestion/src/metadata/profiler/processor/core.py +++ b/ingestion/src/metadata/profiler/processor/core.py @@ -52,6 +52,7 @@ from metadata.profiler.metrics.core import ( TMetric, ) from metadata.profiler.metrics.static.row_count import RowCount +from metadata.profiler.orm.functions.table_metric_computer import CREATE_DATETIME from metadata.profiler.orm.registry import NOT_COMPUTE from metadata.profiler.processor.metric_filter import MetricFilter from metadata.profiler.processor.sample_data_handler import upload_sample_data @@ -579,7 +580,7 @@ class Profiler(Generic[TMetric]): ] raw_create_date: Optional[datetime] = self._table_results.get( - "createDateTime" + CREATE_DATETIME ) if raw_create_date: raw_create_date = raw_create_date.replace(tzinfo=timezone.utc)