Skip to content

Commit

Permalink
Update DriverVersion in Config to 1.0.1 (#94)
Browse files Browse the repository at this point in the history
## Description
In this PR, we update the driver version to 1.0.1 to reflect the latest
cut. We also move the DriverVersion to a more visible const in
`driver.go`.

(Already merged) Most of the code in `driver.go:Open` is the same as
`driver.go:OpenConnector` so these are merged.
  • Loading branch information
mattdeekay committed Jan 23, 2023
2 parents 75b54f0 + b7ea647 commit 39dbe07
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type connOption func(*config.Config)
func NewConnector(options ...connOption) (driver.Connector, error) {
// config with default options
cfg := config.WithDefaults()
cfg.DriverVersion = DriverVersion

for _, opt := range options {
opt(cfg)
Expand Down
3 changes: 3 additions & 0 deletions connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestNewConnector(t *testing.T) {
RetryWaitMax: 60 * time.Second,
}
expectedCfg := config.WithDefaults()
expectedCfg.DriverVersion = DriverVersion
expectedCfg.UserConfig = expectedUserConfig
coni, ok := con.(*connector)
require.True(t, ok)
Expand Down Expand Up @@ -85,6 +86,7 @@ func TestNewConnector(t *testing.T) {
}
expectedCfg := config.WithDefaults()
expectedCfg.UserConfig = expectedUserConfig
expectedCfg.DriverVersion = DriverVersion
coni, ok := con.(*connector)
require.True(t, ok)
assert.Nil(t, err)
Expand Down Expand Up @@ -117,6 +119,7 @@ func TestNewConnector(t *testing.T) {
RetryWaitMax: 0,
}
expectedCfg := config.WithDefaults()
expectedCfg.DriverVersion = DriverVersion
expectedCfg.UserConfig = expectedUserConfig
coni, ok := con.(*connector)
require.True(t, ok)
Expand Down
2 changes: 2 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ func init() {
sql.Register("databricks", &databricksDriver{})
}

var DriverVersion = "1.0.1" // update version before each release

type databricksDriver struct{}

// Open returns a new connection to Databricks database with a DSN string.
Expand Down
1 change: 1 addition & 0 deletions driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestOOpenConnector(t *testing.T) {
}
expectedCfg := config.WithDefaults()
expectedCfg.UserConfig = expectedUserConfig.WithDefaults()
expectedCfg.DriverVersion = DriverVersion
d := &databricksDriver{}
c, err := d.OpenConnector(fmt.Sprintf("token:%s@%s:%d/%s", accessToken, host, port, httpPath))
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ func WithDefaults() *Config {
PingTimeout: 60 * time.Second,
CanUseMultipleCatalogs: true,
DriverName: "godatabrickssqlconnector", // important. Do not change
DriverVersion: "0.9.0",
ThriftProtocol: "binary",
ThriftTransport: "http",
ThriftProtocolVersion: cli_service.TProtocolVersion_SPARK_CLI_SERVICE_PROTOCOL_V6,
Expand Down

0 comments on commit 39dbe07

Please sign in to comment.