Skip to content

Commit

Permalink
Fix lint, package version, and survey config (pinterest#1379)
Browse files Browse the repository at this point in the history
  • Loading branch information
czgu authored and aidenprice committed Jan 3, 2024
1 parent fcebf2e commit e4219dc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "querybook",
"version": "3.28.4",
"version": "3.29.0",
"description": "A Big Data Webapp",
"private": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions querybook/webapp/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 10 additions & 5 deletions querybook/webapp/lib/survey/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import type { ISurveyConfig } from './types';
const surveyConfig = PublicConfig.survey;

export const SURVEY_CONFIG: Record<string, ISurveyConfig> = {};
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,
};
});
2 changes: 1 addition & 1 deletion requirements/engine/bigquery.txt
Original file line number Diff line number Diff line change
@@ -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
sqlalchemy-bigquery==1.8.0

0 comments on commit e4219dc

Please sign in to comment.