Skip to content

Pin serverless databricks-connect to MAJOR.MINOR, not bare major - #29

Merged
rugpanov merged 2 commits into
mainfrom
fix/serverless-dbconnect-minor-pin
Aug 31, 2026
Merged

Pin serverless databricks-connect to MAJOR.MINOR, not bare major#29
rugpanov merged 2 commits into
mainfrom
fix/serverless-dbconnect-minor-pin

Conversation

@rugpanov

Copy link
Copy Markdown
Collaborator

Summary

  • dbconnect_pin() in envgen.py was producing bare-major pins (~=18.0) after PR Pin serverless databricks-connect by major (~=17.0, not ~=17.3.0) #15, allowing any version in the major series (e.g. 18.3.4).
  • The constraint list for each serverless environment is generated from a specific runtime snapshot, so it is only validated against the MAJOR.MINOR release present at generation time.
  • databricks-connect 18.3.4's bundled pyspark pb2 stubs use a _globals pattern requiring protobuf 6.x's BuildTopDescriptorsAndMessages. With v5's protobuf~=5.29.4 constraint, the if not _USE_C_DESCRIPTORS: branch raises NameError: name '_globals' is not defined.
  • Fix: pin to MAJOR.MINOR.0 (~=18.0.0>=18.0.0, <18.1), matching how DBR environments have always been pinned, and regenerate all 6 serverless pyprojects.

Test plan

  • Verify uv sync on a default-python bundle resolves to databricks-connect~=18.0.0 (not 18.3.x)
  • Confirm from databricks.connect import DatabricksSession succeeds after sync
  • CI passes (envgen unit tests + verify_resolve)

A serverless environment's constraint list (protobuf, grpcio, pyarrow,
etc.) is generated from a specific runtime snapshot, so it is only
validated against the MAJOR.MINOR release series present at generation
time.  The previous bare-major pin (``~=18.0``, resolving
``>=18.0, <19``) allowed newer minor releases whose bundled pyspark
protobuf stubs may be incompatible with the pinned runtime libraries.

Concretely, ``databricks-connect~=18.0`` resolved to 18.3.4, whose
pyspark pb2 files use a ``_globals`` pattern intended for protobuf 6.x's
``BuildTopDescriptorsAndMessages``.  With the v5 constraint list's
``protobuf~=5.29.4`` (the runtime version), that method does not inject
``_globals``, so the ``if not _USE_C_DESCRIPTORS:`` branch raises
``NameError: name '_globals' is not defined``.

Fix ``dbconnect_pin()`` to pin to MAJOR.MINOR.0 (``~=18.0.0``,
resolving ``>=18.0.0, <18.1``) — matching what was generated for DBR
environments all along — and regenerate the six serverless pyprojects.

Co-authored-by: Isaac <no-reply@databricks.com>
rclarey
rclarey previously approved these changes Aug 31, 2026
Update the expected value from ``~=17.0`` (the old bare-major pin) to
``~=17.3.0`` (MAJOR.MINOR.0) to match the corrected dbconnect_pin()
and also fix the comment that still said ``~=MAJOR.0``.

Co-authored-by: Isaac <no-reply@databricks.com>
@rugpanov
rugpanov merged commit bdeaa8a into main Aug 31, 2026
2 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