Skip to content

feat: configurable upload limits - #520

Merged
mtcarlone merged 8 commits into
brooklyn-data:mainfrom
kempspo:feature/configurable_upload_limits
Nov 6, 2026
Merged

mtcarlone merged 8 commits into
brooklyn-data:mainfrom
kempspo:feature/configurable_upload_limits

Conversation

@kempspo

@kempspo kempspo commented Aug 24, 2025 •

Copy link
Copy Markdown
Contributor

Overview

Allow users to configure upload limits and add Trino to lower default limits (similar to BigQuery).

Update type - breaking / non-breaking

  • Minor bug fix
  • Documentation improvements
  • Quality of Life improvements
  • New features (non-breaking change)
  • New features (breaking change)
  • Other (non-breaking change)
  • Other (breaking change)
  • Release preparation

What does this solve?

Trino can run into QUERY_TEXT_TOO_LARGE errors. Not all users can/want to reconfigure their Trino instances to handle larger text queries.

This implementation allows the user to instead configure the batching to lower/higher as needed and adds trino to the smaller default pool.

This implmentation takes the same idea from dbt Lab's dbt_project_evaluator.

Outstanding questions

What databases have you tested with?

  • Snowflake
  • Google BigQuery
  • Databricks
  • Spark
  • N/A

@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo
kempspo had a problem deploying to Approve Integration Tests August 24, 2025 02:53 — with GitHub Actions Failure
@kempspo

kempspo commented Aug 30, 2025

Copy link
Copy Markdown
Contributor Author

@mtcarlone could i get you to take a look at this one

@mtcarlone mtcarlone self-assigned this Dec 15, 2025

@mtcarlone mtcarlone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mtcarlone mtcarlone added this to the Jan 2026 Release milestone Jan 28, 2026

@mtcarlone mtcarlone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not backwards compatible

{% else %}
{% set upload_limit = 300 if target.type == 'bigquery' else 5000 %}
{% endif %}
{% set upload_limit = var('insert_batch_size')[dataset if dataset == 'models' else 'default'] %}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kempspo can you rework this so is backwards compatible? CI failed because the variable is not set, and that will cause real failures in other projects.

The batch sizes were added under `models: dbt_artifacts:` in
dbt_project.yml, which is model config rather than `vars:`, so
var('insert_batch_size') didn't exist and every on-run-end hook failed
with "Required var 'insert_batch_size' not found". The rendered values
would also have been strings, which range() rejects.

The adapter defaults now live in upload_results: 100 rows per insert for
models and 5,000 for other datasets, or 50 and 300 on BigQuery and
Trino, keeping this PR's move of Trino into the smaller pool. Consumers
override them with dbt_artifacts_insert_batch_size, a mapping keyed by
'models', 'default' or a dataset name; keys it leaves out keep their
defaults. Values are cast to integers, so strings from env_var() work,
and a non-mapping var or a value below 1 raises a clear compile error.

The dbt_artifacts_ prefix matches the package's other vars and avoids
dbt_project_evaluator's insert_batch_size, a single integer there, which
consumers may set globally.
Explain the default chunk sizes, why BigQuery and Trino use smaller ones
(Trino's query.max-length, QUERY_TEXT_TOO_LARGE), and how to override
them per dataset.
A new singular test compares, for the previous `dbt build`, each
manifest dataset's row count and distinct node_id count with the number
of nodes of that type in the project graph, so a chunk boundary that
drops or repeats rows fails it. The DuckDB tox envs' first build now
uploads with dbt_artifacts_insert_batch_size set to 7 for models and 2
for everything else, which splits most datasets into several chunks for
the second build's tests to check.

Verified it fails when one model row is duplicated, and passes on DuckDB
and SQL Server.
@mtcarlone
mtcarlone self-requested a review November 5, 2026 22:24
@mtcarlone
mtcarlone merged commit 5da7e82 into brooklyn-data:main Nov 6, 2026
5 checks passed
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.

2 participants