From 7ef1e22263145d82c547fa043146569669043dc0 Mon Sep 17 00:00:00 2001 From: Piotr Fus Date: Tue, 19 Nov 2024 08:43:11 +0100 Subject: [PATCH] SNOW-1814531 Implement DriverContext interface --- auth_test.go | 1 - driver.go | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/auth_test.go b/auth_test.go index ccc0f2cd7..c559a2407 100644 --- a/auth_test.go +++ b/auth_test.go @@ -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() diff --git a/driver.go b/driver.go index 99c825ec2..e51bd08b9 100644 --- a/driver.go +++ b/driver.go @@ -33,6 +33,14 @@ func (d SnowflakeDriver) Open(dsn string) (driver.Conn, error) { return d.OpenWithConfig(ctx, *cfg) } +func (d SnowflakeDriver) OpenConnector(dsn string) (driver.Connector, error) { + cfg, err := ParseDSN(dsn) + if err != nil { + return Connector{}, err + } + return NewConnector(SnowflakeDriver{}, *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 {