From 9e4e7e821e7dea7cc6c95af5ed66d4bc41ec9f74 Mon Sep 17 00:00:00 2001 From: czgu Date: Tue, 28 Nov 2023 18:26:25 -0800 Subject: [PATCH] Fix lint, package version, and survey config --- package.json | 2 +- .../loaders/sqlalchemy_metastore_loader.py | 5 ++++- querybook/webapp/config.d.ts | 12 ++++++------ querybook/webapp/lib/survey/config.ts | 15 ++++++++++----- requirements/engine/bigquery.txt | 2 +- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 244cf17f0..c13a7ae23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "querybook", - "version": "3.28.4", + "version": "3.29.0", "description": "A Big Data Webapp", "private": true, "scripts": { diff --git a/querybook/server/lib/metastore/loaders/sqlalchemy_metastore_loader.py b/querybook/server/lib/metastore/loaders/sqlalchemy_metastore_loader.py index 302998db0..3e0dc307f 100644 --- a/querybook/server/lib/metastore/loaders/sqlalchemy_metastore_loader.py +++ b/querybook/server/lib/metastore/loaders/sqlalchemy_metastore_loader.py @@ -25,7 +25,10 @@ def get_all_schema_names(self) -> List[str]: def get_all_table_names_in_schema(self, schema_name: str) -> List[str]: if self._engine.dialect.name == "bigquery": - return [table.split(".")[1] for table in self._inspect.get_table_names(schema=schema_name)] + return [ + table.split(".")[1] + for table in self._inspect.get_table_names(schema=schema_name) + ] else: return self._inspect.get_table_names(schema=schema_name) diff --git a/querybook/webapp/config.d.ts b/querybook/webapp/config.d.ts index 8ee560df5..3b574df96 100644 --- a/querybook/webapp/config.d.ts +++ b/querybook/webapp/config.d.ts @@ -103,13 +103,13 @@ declare module 'config/querybook_public_config.yaml' { enabled: boolean; }; }; - survey: { - global_response_cooldown: number; - global_trigger_cooldown: number; - global_max_per_week: number; - global_max_per_day: number; + survey?: { + global_response_cooldown?: number; + global_trigger_cooldown?: number; + global_max_per_week?: number; + global_max_per_day?: number; - surfaces: Array<{ + surfaces?: Array<{ surface: string; response_cooldown?: number; trigger_cooldown?: number; diff --git a/querybook/webapp/lib/survey/config.ts b/querybook/webapp/lib/survey/config.ts index 4405cda2a..5e5e2e17a 100644 --- a/querybook/webapp/lib/survey/config.ts +++ b/querybook/webapp/lib/survey/config.ts @@ -4,14 +4,19 @@ import type { ISurveyConfig } from './types'; const surveyConfig = PublicConfig.survey; export const SURVEY_CONFIG: Record = {}; -surveyConfig?.surfaces.forEach((surface) => { +surveyConfig?.surfaces?.forEach((surface) => { SURVEY_CONFIG[surface.surface] = { surface: surface.surface, responseCooldown: - surface.response_cooldown ?? surveyConfig.global_response_cooldown, + surface.response_cooldown ?? + surveyConfig.global_response_cooldown ?? + 2592000, // 30 days triggerCooldown: - surface.trigger_cooldown ?? surveyConfig.global_trigger_cooldown, - maxPerWeek: surface.max_per_week ?? surveyConfig.global_max_per_week, - maxPerDay: surface.max_per_day ?? surveyConfig.global_max_per_day, + surface.trigger_cooldown ?? + surveyConfig.global_trigger_cooldown ?? + 600, // 10 minutes + maxPerWeek: + surface.max_per_week ?? surveyConfig.global_max_per_week ?? 3, + maxPerDay: surface.max_per_day ?? surveyConfig.global_max_per_day ?? 1, }; }); diff --git a/requirements/engine/bigquery.txt b/requirements/engine/bigquery.txt index 73ffdf90f..3015d9516 100644 --- a/requirements/engine/bigquery.txt +++ b/requirements/engine/bigquery.txt @@ -1,4 +1,4 @@ google-cloud-bigquery==3.12.0 google-cloud-bigquery-storage==2.22.0 pyarrow==13.0.0 -sqlalchemy-bigquery==1.8.0 \ No newline at end of file +sqlalchemy-bigquery==1.8.0