Skip to content

Migrate from databricks-sdk-go to sdk-go - #7070

Draft
denik wants to merge 39 commits into
mainfrom
denik/migrate-sdk-go
Draft

denik wants to merge 39 commits into
mainfrom
denik/migrate-sdk-go

Conversation

@denik

@denik denik commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Changes

Migrate the CLI from github.com/databricks/databricks-sdk-go to the new github.com/databricks/sdk-go (one module per service, e.g. github.com/databricks/sdk-go/jobs/v2).

The old SDK is still used for authentication and profile resolution only (config, credentials/u2m, useragent, httplog); sdk-go itself depends on it for U2M. Every API call goes through sdk-go clients or, where sdk-go has no client, through a small hand-written REST layer.

Building blocks

  • libs/sdktypes/<module>/<vN> (generated by internal/sdktypesgen, ./task generate-sdktypes): JSON-tagged mirrors of the sdk-go model types. They are derived from sdk-go's unexported wire.go, with flattened oneofs, re-exported enums and generated <T>ToSDK/<T>FromSDK converters. sdk-go model types have no JSON tags and protobuf-style oneofs, so everything that is serialized uses the mirrors: bundle config, direct engine state, --json flags, output rendering and the test server. Fields are ordered by JSON name, like the previous SDK, so output order is unchanged.
  • libs/sdkclients: *sdkclients.Clients replaces both *databricks.WorkspaceClient and *databricks.AccountClient. It has one field per sdk-go module and is built from the CLI's resolved config.Config.
  • libs/apiclient: the shared HTTP transport and raw REST client. It keeps the previous SDK's behaviour where sdk-go differs:
    • User-Agent composition.
    • Retries on 429/503 honouring Retry-After.
    • Inactivity-based HTTP timeout (DATABRICKS_BUNDLE_HTTP_TIMEOUT_SECONDS).
    • Debug request logging.
    • Normalization of non-JSON error bodies.
  • libs/apierrs: error classification with the previous SDK's semantics (Is(err, ErrNotFound), ErrorCode, the missing-object reclassification). It also strips sdk-go's databricks-api error: prefix from user-visible messages.
  • Hand-written clients for APIs sdk-go does not have: libs/workspaceapi, libs/bundledeployments, libs/qualitymonitors, libs/sqllegacy.
  • internal/cligen: retargeted to sdk-go. cmd/workspace and cmd/account are regenerated; 192 cli.json methods without an sdk-go equivalent call libs/apiclient directly.
  • bundle/config/resources and bundle/direct: rewritten on top of the mirror types.
  • bundle/internal/sdkmeta: keeps the bundle JSON schema keyed by the old type names, so the Python classes do not change.

ForceSendFields removed

sdk-go expresses "set to zero" with pointers, so all ForceSendFields support is gone (libs/structs, libs/dyn/convert, marshal wrappers). Two changes preserve the old zero-value behaviour:

  • An explicitly set zero scalar on API types (for example parent_path: "") survives typed round trips.
  • DropEmptyStrings keeps empty strings on required fields.

Behaviour changes and known gaps

  • Request bodies: sdk-go repeats path parameters in request bodies, for example request_object_type/request_object_id, name, full_name_arg, dashboard_id, pipeline_id and securable_*. Recorded requests in acceptance tests change accordingly. Recorded bodies are now written with sorted keys, so key-order noise is gone.
  • Oneof conflicts: sdk-go rejects requests and responses that set more than one member of a oneof. Bundle configs that set both autoscale and num_workers now get a warning, and num_workers is dropped. Other conflicts, such as two task types in one task or app env value together with value_from, are reported as only one of X, Y can be set.
  • Postgres field masks: sdk-go's FieldMask rejects oneof group names (spec.expiration, spec.suspension) that the Postgres API requires in update_mask. Bundle deploy sends those updates through libs/apiclient. databricks postgres update-{branch,endpoint,project} cannot use group names; use databricks api patch instead.
  • Fields missing from sdk-go:
    • Model serving workload_type.
    • Pipeline cluster init_scripts and cluster_log_conf destinations other than dbfs/s3.
    • The --purpose flag on credentials commands.
    • Hidden --page-size on quality-monitor-v2 list-quality-monitor.
    • clusters list --sort-by.
    • Lakeview create etag.
    • --read-mask on agent-kit memory commands.
    • workspace-conf get-status --keys.
  • SCIM v1 commands (users, groups, service-principals) are thin wrappers over the v2 commands. They gain --limit.
  • Explicit nulls: a null on a pointer field (for example run_job_task: with no value) can't be represented, so the "required field job_id" warning for that case is gone.
  • Plan output: bundle plan -o json no longer prints zero-valued remote fields such as "remote": "" or embed_credentials: false.
  • Error messages from request construction lose the failed during request visitor: prefix.

Tests

  • Unit tests pass (go test ./...).
  • Acceptance tests pass locally, except tests that build Python wheels; those fail on the dev machine for environment reasons. Goldens are updated where behaviour genuinely changed as listed above, and several test fixtures that relied on lenient decoding in the old SDK were fixed (e.g. a numeric pipeline_id).
  • New unit tests cover the inactivity timeout, error body normalization, pointer query parameters and sequence_id decoding.

This pull request and its description were written by Isaac.

denik and others added 30 commits October 14, 2026 21:18
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…oscale

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…p sdk-go error prefix

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…lete; drop unsafe field masks

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
denik and others added 8 commits October 15, 2026 10:02
…peline fixtures

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
…ames; fixture fixes

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added DABs DABs related issues PyDABs AIR Databricks AI Runtime CLI labels Oct 15, 2026
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 0f4d975

Run: 38736579224

Env ❌​FAIL 🔄​flaky ✅​pass 🙈​skip Time
❌​ aws linux-2core-8gb 1 303 54 18:30
❌​ aws-windows-latest-4core-16gb 1 305 52 20:31
❌​ azure linux-2core-8gb 1 300 56 18:05
❌​ azure-windows-latest-4core-16gb 1 302 54 18:51
❌​ gcp linux-2core-8gb 1 301 56 15:14
❌​ gcp-windows-latest-4core-16gb 1 2 301 54 18:40
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
🔄​ TestFsCpFileToFile ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f
🔄​ TestFsCpFileToFile/uc-volumes_to_uc-volumes ✅​p ✅​p ✅​p ✅​p ✅​p 🔄​f
❌​ TestSQLExecNullParameter ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
Top 42 slowest tests (at least 2 minutes):
duration env testname
9:45 aws-windows-latest-4core-16gb TestAccept
9:41 gcp-windows-latest-4core-16gb TestAccept
9:35 azure-windows-latest-4core-16gb TestAccept
9:08 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
8:42 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
8:18 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
8:06 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
7:47 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
7:44 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
7:35 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
7:35 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
7:11 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
6:22 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
6:18 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=
5:48 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started/DMS=true
5:43 gcp linux-2core-8gb TestAccept
5:42 azure linux-2core-8gb TestAccept
5:30 aws linux-2core-8gb TestAccept
3:52 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true
3:50 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=
3:39 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true
3:25 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=
3:22 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
3:08 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true
3:08 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true
3:06 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
3:01 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
2:56 aws linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
2:54 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=
2:50 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=
2:49 azure-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
2:42 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
2:38 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
2:36 azure linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
2:34 aws-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
2:28 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true
2:25 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
2:20 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=true
2:18 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=true
2:17 gcp linux-2core-8gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=
2:14 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-omitted/DMS=
2:01 gcp-windows-latest-4core-16gb TestAccept/bundle/resources/apps/lifecycle-started-toggle/DMS=

Unused helpers left over from porting retries, dbfs and sqllegacy from the
previous SDK.

Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

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

Labels

AIR Databricks AI Runtime CLI DABs DABs related issues PyDABs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants