Skip to content

[BUG] [BQ] persist_docs on seeds with empty description causes BigQuery syntax error #1383

@b-per

Description

@b-per

Description

When persist_docs: {relation: true} is set at project level, seeds without a description in schema.yml call adapter.update_table_description() with an empty string. BigQuery receives only a query comment with no SQL and returns a syntax error.

Root cause

The guard in bigquery__load_csv_rows (dbt-bigquery/macros/materializations/seed.sql:31) checks:

{% if config.persist_relation_docs() and 'description' in model %}

'description' in model tests whether the key exists in the dict — not whether the value is truthy. Every seed has a description key (set to "" when unset), so the check always passes.

Compare with bigquery__persist_docs in adapters.sql, which correctly uses model.description (Jinja truthiness, where "" is falsy).

The bug has been present since the file was first created in 879010b248 (2025-05-28).

Repro

dbt_project.yml

name: 'bigquery_seed_empty_description'
config-version: 2
version: '0.1'
profile: 'integration_tests'

seeds:
  +persist_docs:
    relation: true

seeds/has_description.csv

id,name
1,alice
2,bob

seeds/no_description.csv

id,name
1,charlie
2,dana

seeds/properties.yml

version: 2

seeds:
  - name: has_description
    description: "Seed with a description"

Run: fs seed -t bq

Expected

Both seeds succeed. Seeds with no description should skip the update_table_description call.

Actual

no_description fails:

error: dbt1308: Error executing materialization macro 'dbt.materialization_seed_default'
  for seed seed.bigquery_seed_empty_description.no_description:
  [BigQuery] googleapi: Error 400: Syntax error: Unexpected end of statement at [1:169], invalidQuery

logs/query_log.sql shows the failing entry sends only a query comment with no SQL:

-- desc: update_table_description adapter call
/* {"app": "dbt", ...} */
;

Suggested fix

Change the condition in seed.sql:31 from:

{% if config.persist_relation_docs() and 'description' in model %}

to:

{% if config.persist_relation_docs() and model.description %}

This matches the pattern used in bigquery__persist_docs.

Alternatively, the Rust side (typed_adapter.rs:2049) could early-return when description is empty instead of sending empty SQL to execute_with_options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bigquerybugSomething isn't workinghas-reproHas a reproducible example

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions