Skip to content

Conversation

@jayantsing-db
Copy link

@jayantsing-db jayantsing-db commented Nov 17, 2025

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

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

Related

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

@jayantsing-db
Copy link
Author

Why is DCO check failing post sign-off?

jayantsing-db and others added 4 commits November 17, 2025 20:41
Signed-off-by: Jayant Singh <[email protected]>
This commit implements the foundational configuration support for protocol
selection between Thrift and REST protocols as part of Statement Execution
API (SEA) Phase 1.

Changes:
- Added ExecutionProtocol field to UserConfig (defaults to "thrift")
- Added WarehouseID field to UserConfig (required for REST protocol)
- Added MaxPollInterval and PollBackoffMultiplier fields to Config
- Implemented DSN parsing for protocol/executionProtocol parameters
- Implemented DSN parsing for warehouse_id/warehouseId parameters
- Added validation to require warehouse_id when using REST protocol
- Updated DeepCopy methods to include new fields
- Updated WithDefaults to set proper default values:
  - ExecutionProtocol: "thrift" (backward compatible)
  - MaxPollInterval: 60 seconds
  - PollBackoffMultiplier: 2.0
- Added comprehensive unit tests for all new functionality

The implementation supports both snake_case and camelCase parameter names
for user convenience (protocol/executionProtocol, warehouse_id/warehouseId).

Related design doc: statement-execution-api-design-go.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Jayant Singh <[email protected]>
Fix gofmt linting issues by aligning struct field declarations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Jayant Singh <[email protected]>
Update connector test expectations to include ExecutionProtocol: 'thrift'
as the default value, consistent with the new configuration defaults.

This fixes test failures in:
- Connector initialized with functional options
- Connector initialized minimal settings
- Connector initialized with retries turned off

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Jayant Singh <[email protected]>
@jayantsing-db jayantsing-db force-pushed the PECOBLR-1172-add-configuration-protocol-selection branch from 62d4f09 to 466291c Compare November 17, 2025 20:41
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