-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
hack to deal with snowflake including quotes in namesIt appears that at some point snowflake started including double-quotes in role names when you use that syntax to create role grants. It appears to be a regression, since our code used to work and no longer does (with no changes). This hack should be safe once they fix it because double-quote is not a legal part of the name.
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package db | ||
|
||
import ( | ||
"context" | ||
"database/sql" | ||
"fmt" | ||
"regexp" | ||
|
||
"github.com/ExpansiveWorlds/instrumentedsql" | ||
"github.com/snowflakedb/gosnowflake" | ||
) | ||
|
||
func init() { | ||
re := regexp.MustCompile(`\r?\n`) | ||
|
||
logger := instrumentedsql.LoggerFunc(func(ctx context.Context, msg string, keyvals ...interface{}) { | ||
s := fmt.Sprintf("[DEBUG] %s %v\n", msg, keyvals) | ||
fmt.Println(re.ReplaceAllString(s, " ")) | ||
}) | ||
|
||
sql.Register("snowflake-instrumented", instrumentedsql.WrapDriver(&gosnowflake.SnowflakeDriver{}, instrumentedsql.WithLogger(logger))) | ||
} | ||
|
||
func Open(dsn string) (*sql.DB, error) { | ||
return sql.Open("snowflake-instrumented", dsn) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.