Databricks SQL ExecuteStatement Failing During Chunked Updates to a Single Cell (Large JSON Field)

Open
#592 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
python, sql, sqlalchemy
Domain
database

Research direction

Start with the SQLAlchemy and Databricks SQL ExecuteStatement path described in the report, then reproduce the chunked UPDATE sequence using a large JSON field. Compare the request size at failure and inspect the connector’s handling of retry codes 429 and 503. Done means documenting the request limit and an approved incremental-update practice.

Written by the indexing model from the issue text.

Description

We’re encountering issues with Databricks SQL when attempting to update a row that contains a large JSON array field. Originally, we tried inserting the entire JSON directly into the column, but this failed due to request size limitations.
To address that, we redesigned the approach to:

  • Split the full JSON into smaller chunks (~100 items)
  • Append each chunk incrementally to the same row/column using separate UPDATE statements
  • Commit each chunk using a new thread and session to ensure SQLAlchemy thread safety

Despite chunking, the request eventually fails when the dmt_data field grows large enough (presumably ~1–2MB compressed). The SQL API returns:

pgsqlCopyEdit(databricks.sql.exc.RequestError) Error during request to server. 
ExecuteStatement command can only be retried for codes 429 and 503 

This confirms that each UPDATE's request body is still exceeding Databricks SQL's internal limits, even though we’re only appending small pieces.
What We’re Looking For:

  • Confirmation of the exact request body size limit for INSERT/UPDATE operations over Databricks SQL
  • Recommended practice for incrementally updating a single JSON column that grows over time
Dominant language
Python
Stars
233
Forks
152
Avg merge
21h 5m
Merged PRs (30d)
10

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databricks/databricks-sql-python

All issues in databricks/databricks-sql-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.