databricks-sql-go icon indicating copy to clipboard operation
databricks-sql-go copied to clipboard

[PECOBLR-1172] Add Configuration and Protocol Selection for SEA Phase 1

Open jayantsing-db opened this issue 3 months ago • 1 comments

Summary

This PR implements Task 1 of SEA (Statement Execution API) Phase 1: Add Configuration and Protocol Selection support for the Databricks SQL Go driver.

This is a foundational change that enables protocol selection between Thrift (existing) and REST (new Statement Execution API) protocols.

Changes

Configuration Fields Added

UserConfig:

  • ExecutionProtocol (string): Selects between "thrift" (default) or "rest"
  • WarehouseID (string): Required when using REST protocol

Config:

  • MaxPollInterval (time.Duration): Maximum polling interval for exponential backoff (default: 60s)
  • PollBackoffMultiplier (float64): Multiplier for exponential backoff (default: 2.0)

DSN Parsing

Implemented parsing for the following query parameters:

  • protocol or executionProtocol: Sets the execution protocol
  • warehouse_id or warehouseId: Sets the warehouse ID (supports both naming conventions)

Example DSN: token:[email protected]:443/sql/1.0/endpoints/abc123?protocol=rest&warehouse_id=warehouse123

Validation

Added validation to ensure warehouse_id is provided when using protocol=rest. Returns a clear error message if missing.

Default Values

  • ExecutionProtocol: "thrift" (maintains backward compatibility)
  • MaxPollInterval: 60 seconds
  • PollBackoffMultiplier: 2.0
  • Existing PollInterval: 1 second (unchanged)

Testing

  • Added 7 new test cases covering:
    • Protocol parameter parsing (thrift/rest)
    • Warehouse ID parsing (snake_case and camelCase)
    • Validation error when REST protocol missing warehouse_id
    • Alternative parameter names (executionProtocol)
    • Backward compatibility (default protocol is thrift)
  • Updated all existing test cases to include new default fields
  • Added tests for default values and DeepCopy functionality

All tests pass successfully.

Design Reference

Implementation follows the design document: statement-execution-api-design-go.md

Backward Compatibility

✅ All changes are backward compatible:

  • Existing code continues to work without changes
  • Default protocol is "thrift"
  • New fields are optional (except warehouse_id when using REST)

Next Steps

This PR enables the foundation for subsequent SEA Phase 1 tasks:

  • Task 2: Implement REST client infrastructure
  • Task 3: Add result fetching capabilities

Test Plan

  • [x] All existing unit tests pass
  • [x] New unit tests added and passing
  • [x] Build succeeds without errors
  • [x] Pre-commit hooks pass

Related

  • JIRA: PECOBLR-1172
  • Design Doc: statement-execution-api-design-go.md

jayantsing-db avatar Nov 17 '25 20:11 jayantsing-db

Why is DCO check failing post sign-off?

jayantsing-db avatar Nov 17 '25 20:11 jayantsing-db