MINOR: fix bigquery profiler (#16933)

* fix: bigquery profiler

cast creation_time from __TABLES__ to datetime

* format

* removed comment

* format
This commit is contained in:
Imri Paran 2024-07-05 12:21:43 +02:00 committed by GitHub
parent 43f46196a4
commit da6da45373
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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(

View File

@ -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)