windmill-labs/windmill · error
BigQuery requires a dataset (schema) name
Error message
BigQuery requires a dataset (schema) name
What it means
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.
Source
Thrown at frontend/src/lib/components/apps/components/display/dbtable/queries/relationalKeys.ts:316
function makeSnowflakePrimaryKeyQuery(tableName: string, schemaName: string): string {
return `
SELECT
constraint_name
FROM
information_schema.table_constraints
WHERE
constraint_type = 'PRIMARY KEY'
AND table_name = '${tableName}'
AND table_schema = '${schemaName}'
LIMIT 1;
`.trim()
}
// BigQuery queries
function makeBigQueryForeignKeysQuery(tableName: string, schemaName?: string): string {
if (!schemaName) {
throw new Error('BigQuery requires a dataset (schema) name')
}
return `
SELECT
tc.constraint_name as fk_constraint_name,
kcu.column_name as source_column,
ccu.table_name as target_table,
ccu.column_name as target_column,
'NO ACTION' as on_delete,
'NO ACTION' as on_update
FROM
\`${schemaName}.INFORMATION_SCHEMA.TABLE_CONSTRAINTS\` tc
JOIN \`${schemaName}.INFORMATION_SCHEMA.KEY_COLUMN_USAGE\` kcu
ON tc.constraint_name = kcu.constraint_name
JOIN \`${schemaName}.INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE\` ccu
ON tc.constraint_name = ccu.constraint_name
WHERE
tc.constraint_type = 'FOREIGN KEY'View on GitHub (pinned to e474e8803c)
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.
Example fix
// before
const q = makeForeignKeysQuery('bigquery', 'my_table', undefined)
// after
const q = makeForeignKeysQuery('bigquery', 'my_table', 'my_dataset') // project.my_dataset.my_table Defensive patterns
Strategy: validation
Validate before calling
if (dbType === 'bigquery' && !schemaName) {
throw new Error('Select a BigQuery dataset before exploring relations')
}
const q = makeForeignKeysQuery(dbType, tableName, schemaName) Type guard
const hasBigQueryDataset = (s: unknown): s is string => typeof s === 'string' && s.trim().length > 0
Try / catch
try {
const q = makeForeignKeysQuery('bigquery', tableName, schemaName)
} catch (e) {
if (e instanceof Error && e.message.includes('dataset (schema) name')) {
showToast('BigQuery requires a dataset — select one first')
return null
}
throw e
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Column ${column.field} is not nullable and has no default va
- Unsupported database type: ${dbType}
- Invalid language: ${language}
- Unsupported database type:${dbType}
- Unsupported database type
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/f886662fcac08261.
Report an issue: GitHub.