Skip to content

Commit

Permalink
Merge branch 'master' into test_put_overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pfus authored Nov 22, 2024
2 parents e781ed2 + ce3db31 commit d7de5fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,6 @@ func TestOktaRetryWithNewToken(t *testing.T) {
}

func TestContextPropagatedToAuthWhenUsingOpen(t *testing.T) {
t.Skip("dsnConnector loses context when opening using sql.Open")
db, err := sql.Open("snowflake", dsn)
assertNilF(t, err)
defer db.Close()
Expand Down
2 changes: 1 addition & 1 deletion connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Connector struct {
}

// NewConnector creates a new connector with the given SnowflakeDriver and Config.
func NewConnector(driver InternalSnowflakeDriver, config Config) Connector {
func NewConnector(driver InternalSnowflakeDriver, config Config) driver.Connector {
return Connector{driver, config}
}

Expand Down
9 changes: 9 additions & 0 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ func (d SnowflakeDriver) Open(dsn string) (driver.Conn, error) {
return d.OpenWithConfig(ctx, *cfg)
}

// OpenConnector creates a new connector with parsed DSN.
func (d SnowflakeDriver) OpenConnector(dsn string) (driver.Connector, error) {
cfg, err := ParseDSN(dsn)
if err != nil {
return Connector{}, err
}
return NewConnector(d, *cfg), nil
}

// OpenWithConfig creates a new connection with the given Config.
func (d SnowflakeDriver) OpenWithConfig(ctx context.Context, config Config) (driver.Conn, error) {
if err := config.Validate(); err != nil {
Expand Down

0 comments on commit d7de5fd

Please sign in to comment.