From 02ff83ca056b052c48338c64b9dfefc106bd3864 Mon Sep 17 00:00:00 2001 From: Elon Gliksberg Date: Thu, 22 Jun 2023 11:57:53 +0300 Subject: [PATCH] Moved 'warehouse_type' to be part of 'env'. --- elementary/monitor/api/report/report.py | 7 ++++--- elementary/monitor/api/report/schema.py | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/elementary/monitor/api/report/report.py b/elementary/monitor/api/report/report.py index b864a4bd3..932ca6e43 100644 --- a/elementary/monitor/api/report/report.py +++ b/elementary/monitor/api/report/report.py @@ -15,7 +15,7 @@ NormalizedSourceSchema, TotalsSchema, ) -from elementary.monitor.api.report.schema import ReportDataSchema +from elementary.monitor.api.report.schema import ReportDataEnvSchema, ReportDataSchema from elementary.monitor.api.tests.schema import TestResultSchema, TestRunSchema from elementary.monitor.api.tests.tests import TestsAPI from elementary.monitor.data_monitoring.schema import SelectorFilterSchema @@ -121,8 +121,9 @@ def get_report_data( invocations=invocations, resources_latest_invocation=resources_latest_invocation, invocations_job_identification=invocations_job_identification, - env=dict(project_name=project_name, env=env), - warehouse_type=warehouse_type, + env=ReportDataEnvSchema( + project_name=project_name, env=env, warehouse_type=warehouse_type + ), ) return report_data, None except Exception as error: diff --git a/elementary/monitor/api/report/schema.py b/elementary/monitor/api/report/schema.py index bf04470b2..bd447bc1b 100644 --- a/elementary/monitor/api/report/schema.py +++ b/elementary/monitor/api/report/schema.py @@ -3,6 +3,12 @@ from pydantic import BaseModel +class ReportDataEnvSchema(BaseModel): + project_name: Optional[str] = None + env: Optional[str] = None + warehouse_type: Optional[str] = None + + class ReportDataSchema(BaseModel): creation_time: Optional[str] = None days_back: Optional[int] = None @@ -21,6 +27,5 @@ class ReportDataSchema(BaseModel): invocations: list = list() resources_latest_invocation: dict = dict() invocations_job_identification: dict = dict() - env: dict = dict() + env: ReportDataEnvSchema = ReportDataEnvSchema() tracking: Optional[dict] = None - warehouse_type: Optional[str] = None