Skip to content

Commit 4e727b4

Browse files
authored
Add user_agent plumbing for upstream users. (#93)
1 parent 358335b commit 4e727b4

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

go/adbc/driver/databricks/database.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type databaseImpl struct {
5757
port int
5858
catalog string
5959
schema string
60+
user_agent string
6061

6162
// Query options
6263
queryTimeout time.Duration
@@ -99,6 +100,7 @@ func (d *databaseImpl) resolveConnectionOptions() ([]dbsql.ConnOption, error) {
99100
opts := []dbsql.ConnOption{
100101
dbsql.WithServerHostname(d.serverHostname),
101102
dbsql.WithHTTPPath(d.httpPath),
103+
dbsql.WithUserAgentEntry(d.user_agent),
102104
}
103105

104106
// Handle Auth configurations and validate based on user selected auth type
@@ -291,6 +293,8 @@ func (d *databaseImpl) GetOption(key string) (string, error) {
291293
return d.catalog, nil
292294
case OptionSchema:
293295
return d.schema, nil
296+
case OptionUserAgent:
297+
return d.user_agent, nil
294298
case OptionQueryTimeout:
295299
if d.queryTimeout > 0 {
296300
return d.queryTimeout.String(), nil
@@ -363,6 +367,8 @@ func (d *databaseImpl) SetOption(key, value string) error {
363367
d.catalog = value
364368
case OptionSchema:
365369
d.schema = value
370+
case OptionUserAgent:
371+
d.user_agent = value
366372
case OptionQueryTimeout:
367373
if value != "" {
368374
timeout, err := time.ParseDuration(value)

go/adbc/driver/databricks/driver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const (
4646
OptionPort = "databricks.port"
4747
OptionCatalog = "databricks.catalog"
4848
OptionSchema = "databricks.schema"
49+
OptionUserAgent = "databricks.user_agent"
4950

5051
// Query options
5152
OptionQueryTimeout = "databricks.query.timeout"

0 commit comments

Comments
 (0)