Skip to content

feat(bigquery): make table description length configurable - #6273

Open
Vamsi-klu wants to merge 1 commit into
SQLMesh:mainfrom
Vamsi-klu:codex/feat-5581-bigquery-description-limit
Open

Vamsi-klu wants to merge 1 commit into
SQLMesh:mainfrom
Vamsi-klu:codex/feat-5581-bigquery-description-limit

Conversation

@Vamsi-klu

@Vamsi-klu Vamsi-klu commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #5581.

Add max_table_comment_length to BigQuery connection configuration. SQLMesh uses 1,024 characters by default and accepts configured limits from 1 to 16,384 for table and view descriptions. Set max_table_comment_length: 16384 on the gateway connection to use BigQuery’s full description quota. BigQuery quotas

Test Plan

  • test_bigquery.py and test_connection_config.py passed with 129 tests.
  • Covered the default and configured limits in SQL for table creation, CTAS, comment updates, views, and materialized views. Tested validation for values outside the supported range.
  • make style passed.

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO

Summary by CodeRabbit

  • New Features
    • BigQuery connections now support a configurable maximum length for table and view descriptions. The default is 1,024 characters; values from 1 to 16,384 are supported.
  • Documentation
    • Updated the BigQuery connection options reference with the new setting and its accepted range.

Fixes SQLMesh#5581

Signed-off-by: Vamsi-klu <nrvamsi13@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

BigQuery connection configuration now accepts an optional table-comment length limit from 1 to 16,384. The adapter uses that limit when truncating table comments and retains the 1,024-character default when the option is unset. Tests and documentation cover the setting.

Changes: BigQuery table comment length

Layer / File(s) Summary
Configure and apply the comment limit
sqlmesh/core/config/connection.py, sqlmesh/core/engine_adapter/bigquery.py, tests/core/engine_adapter/test_bigquery.py, docs/integrations/engines/bigquery.md
The connection config validates and passes the optional limit to the adapter. The adapter applies it during comment truncation. Tests cover default and configured limits and reject values outside the allowed range. The documentation describes the option and its default.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature · Severity of issue fixed: Low

Suggested reviewers: stuffbyyuki

Merge Risk: Minimal · up to 512c3

This adds an optional BigQuery setting for the table and view description length limit. Existing behavior is unchanged when the setting is not used, so merge-readiness risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: BigQuery table description length becomes configurable through a new max_table_comment_length setting. The changeset adds that setting to the connection config, the ad…
Description check Passed The description follows the template's main sections. It has a Description that states the new max_table_comment_length option, its default of 1,024 and its range of 1 to 16,384, and it references iss…
Linked Issues check Passed Issue #5581 asks whether the 1,024-character BigQuery table comment limit has a rationale, and whether it can match BigQuery's 16,384-character quota. The PR does not change the default. It adds an op…
Out of Scope Changes check Passed All changed areas connect to the linked issue. sqlmesh/core/config/connection.py adds the new config field and passes it in the extra engine configuration. sqlmesh/core/engine_adapter/bigquery.py …
Full details: Title check

Explanation

The title names the main change: BigQuery table description length becomes configurable through a new max_table_comment_length setting. The changeset adds that setting to the connection config, the adapter truncation helper, and tests, so the title matches the primary change.

Full details: Description check

Explanation

The description follows the template's main sections. It has a Description that states the new max_table_comment_length option, its default of 1,024 and its range of 1 to 16,384, and it references issue #5581. The Test Plan lists the test files, the covered SQL cases, and the validation tests. The Checklist is present. One checklist item is unchecked: the author did not run make fast-test, and the description does not explain why.

Full details: Linked Issues check

Explanation

Issue #5581 asks whether the 1,024-character BigQuery table comment limit has a rationale, and whether it can match BigQuery's 16,384-character quota. The PR does not change the default. It adds an optional max_table_comment_length field to BigQueryConnectionConfig (ge=1, le=16_384, default None). When set, the BigQuery adapter truncates table comments to that value. When unset, it falls back to MAX_TABLE_COMMENT_LENGTH (1,024). This lets users opt in to the full 16,384-character quota, which meets the practical need in the issue. The issue asks whether the team would consider raising the default. It does not require a default change, so the coding requirement is met. The tests cover default and configured limits for table creation, CTAS, comment updates, views, and materialized views, and cover out-of-range validation (0 and 16,385 raise ValidationError). The evidence is the PR summary and description; I did not inspect the source diff directly. No unresolved gap affects the verdict.

Full details: Out of Scope Changes check

Explanation

All changed areas connect to the linked issue. sqlmesh/core/config/connection.py adds the new config field and passes it in the extra engine configuration. sqlmesh/core/engine_adapter/bigquery.py adds _truncate_table_comment, which applies the configured limit in the existing table-comment SQL builder. tests/core/engine_adapter/test_bigquery.py tests the default and configured limits and the validation bounds. docs/integrations/engines/bigquery.md documents the new option. No unrelated behavior change appears in the summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1cf26a8f-bc93-4c7a-8efe-ac602676cc9d
Commits

Reviewing files that changed from the base of the PR and between ce229ae and 512c3fc.

Files selected for processing: 4

  • docs/integrations/engines/bigquery.md
  • sqlmesh/core/config/connection.py
  • sqlmesh/core/engine_adapter/bigquery.py
  • tests/core/engine_adapter/test_bigquery.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@Vamsi-klu

Copy link
Copy Markdown
Contributor Author

Could a SQLMesh maintainer approve the GitHub Actions workflows for this PR? Both CI and the DCO check are awaiting approval. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rationale for MAX_TABLE_COMMENT_LENGTH=1024 for BigQuery (official quota 16,384)

1 participant