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

feat(go/adbc/driver/snowflake): add '[ADBC]' to snowflake application name #1525

Merged
merged 6 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions go/adbc/driver/snowflake/snowflake_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ func (d *databaseImpl) SetOptions(cnOptions map[string]string) error {
}
}

defaultAppName := "[ADBC][Go-" + infoDriverVersion + "]"
// set default application name to track
// unless user overrides it
d.cfg.Application = defaultAppName

var err error
for k, v := range cnOptions {
v := v // copy into loop scope
Expand Down Expand Up @@ -265,6 +270,9 @@ func (d *databaseImpl) SetOptions(cnOptions map[string]string) error {
}
d.cfg.ClientTimeout = dur
case OptionApplicationName:
if !strings.HasPrefix(v, "[ADBC]") {
v = defaultAppName + v
}
d.cfg.Application = v
case OptionSSLSkipVerify:
switch v {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def connect(
kwargs = (db_kwargs or {}).copy()
if uri is not None:
kwargs["uri"] = uri
appname = kwargs.get(DatabaseOptions.APPLICATION_NAME.value, "")
kwargs[
DatabaseOptions.APPLICATION_NAME.value
] = f"[ADBC][Python-{__version__}]{appname}"
return adbc_driver_manager.AdbcDatabase(driver=_driver_path(), **kwargs)


Expand Down
Loading