{"record":{"id":"f886662fcac08261","repo":"windmill-labs/windmill","slug":"bigquery-requires-a-dataset-schema-name","errorCode":null,"errorMessage":"BigQuery requires a dataset (schema) name","messagePattern":"BigQuery requires a dataset \\(schema\\) name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/apps/components/display/dbtable/queries/relationalKeys.ts","lineNumber":316,"sourceCode":"\nfunction makeSnowflakePrimaryKeyQuery(tableName: string, schemaName: string): string {\n\treturn `\nSELECT\n    constraint_name\nFROM\n    information_schema.table_constraints\nWHERE\n    constraint_type = 'PRIMARY KEY'\n    AND table_name = '${tableName}'\n    AND table_schema = '${schemaName}'\nLIMIT 1;\n`.trim()\n}\n\n// BigQuery queries\nfunction makeBigQueryForeignKeysQuery(tableName: string, schemaName?: string): string {\n\tif (!schemaName) {\n\t\tthrow new Error('BigQuery requires a dataset (schema) name')\n\t}\n\n\treturn `\nSELECT\n    tc.constraint_name as fk_constraint_name,\n    kcu.column_name as source_column,\n    ccu.table_name as target_table,\n    ccu.column_name as target_column,\n    'NO ACTION' as on_delete,\n    'NO ACTION' as on_update\nFROM\n    \\`${schemaName}.INFORMATION_SCHEMA.TABLE_CONSTRAINTS\\` tc\n    JOIN \\`${schemaName}.INFORMATION_SCHEMA.KEY_COLUMN_USAGE\\` kcu\n        ON tc.constraint_name = kcu.constraint_name\n    JOIN \\`${schemaName}.INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE\\` ccu\n        ON tc.constraint_name = ccu.constraint_name\nWHERE\n    tc.constraint_type = 'FOREIGN KEY'","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/apps/components/display/dbtable/queries/relationalKeys.ts#L298-L334","documentation":"BigQuery organizes tables under datasets, and its INFORMATION_SCHEMA queries require the dataset name as the schema qualifier. makeBigQueryForeignKeysQuery therefore refuses to run when schemaName is undefined/empty, because the generated `dataset.INFORMATION_SCHEMA.*` SQL would be invalid or ambiguous. Note makeForeignKeysQuery passes schemaName through as-is (no default), so unlike snowflake/duckdb there is no fallback.","triggerScenarios":"Requesting foreign keys for a BigQuery table while the schema/dataset field is empty — e.g. the user did not pick a dataset in the table editor, the schema came from an unfilled app variable, or the table reference was entered without a dataset.","commonSituations":"BigQuery resource where tables are browsed without selecting a dataset first; app config storing only the table name; migrations or UI changes that stopped propagating schemaName.","solutions":["Always pass the BigQuery dataset as schemaName when calling makeForeignKeysQuery.","In the UI, require dataset selection before enabling the relations panel for bigquery dbType.","Derive the dataset from the fully-qualified table reference (project.dataset.table) if only the table was given.","Use a sensible default dataset in the app config if the app always targets one dataset."],"exampleFix":"// before\nconst q = makeForeignKeysQuery('bigquery', 'my_table', undefined)\n// after\nconst q = makeForeignKeysQuery('bigquery', 'my_table', 'my_dataset') // project.my_dataset.my_table","handlingStrategy":"validation","validationCode":"if (dbType === 'bigquery' && !schemaName) {\n  throw new Error('Select a BigQuery dataset before exploring relations')\n}\nconst q = makeForeignKeysQuery(dbType, tableName, schemaName)","typeGuard":"const hasBigQueryDataset = (s: unknown): s is string =>\n  typeof s === 'string' && s.trim().length > 0","tryCatchPattern":"try {\n  const q = makeForeignKeysQuery('bigquery', tableName, schemaName)\n} catch (e) {\n  if (e instanceof Error && e.message.includes('dataset (schema) name')) {\n    showToast('BigQuery requires a dataset — select one first')\n    return null\n  }\n  throw e\n}","preventionTips":["Always require dataset selection in the UI for bigquery before metadata queries","Derive the dataset from fully-qualified table refs (project.dataset.table)","Configure a default dataset in the app when only one is used","Remember bigquery has no default-schema fallback unlike snowflake/duckdb"],"tags":["database","bigquery","schema","metadata"],"backgroundTag":"missing-schema-or-dataset-name","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}