Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DriverVersion in Config to 1.0.1 #94

Merged
merged 3 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/stretchr/testify/require"
)

var ExpectedDriverVersion = "1.0.1"
mattdeekay marked this conversation as resolved.
Show resolved Hide resolved

func TestNewConnector(t *testing.T) {
t.Run("Connector initialized with functional options should have all options set", func(t *testing.T) {
host := "databricks-host"
Expand Down Expand Up @@ -52,6 +54,7 @@ func TestNewConnector(t *testing.T) {
RetryWaitMax: 60 * time.Second,
}
expectedCfg := config.WithDefaults()
expectedCfg.DriverVersion = ExpectedDriverVersion
expectedCfg.UserConfig = expectedUserConfig
coni, ok := con.(*connector)
require.True(t, ok)
Expand Down Expand Up @@ -117,6 +120,7 @@ func TestNewConnector(t *testing.T) {
RetryWaitMax: 0,
}
expectedCfg := config.WithDefaults()
expectedCfg.DriverVersion = ExpectedDriverVersion
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: 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