@@ -58,6 +58,9 @@ func init() {
58
58
// - `region` (optional)
59
59
// Override AWS region. Useful if it is not set with environment variable.
60
60
//
61
+ // - `workgroup` (optional)
62
+ // Athena's workgroup. This defaults to "primary".
63
+ //
61
64
// Credentials must be accessible via the SDK's Default Credential Provider Chain.
62
65
// For more advanced AWS credentials/session/config management, please supply
63
66
// a custom AWS session directly via `athena.Open()`.
@@ -80,6 +83,7 @@ func (d *Driver) Open(connStr string) (driver.Conn, error) {
80
83
db : cfg .Database ,
81
84
OutputLocation : cfg .OutputLocation ,
82
85
pollFrequency : cfg .PollFrequency ,
86
+ workgroup : cfg .WorkGroup ,
83
87
}, nil
84
88
}
85
89
@@ -99,6 +103,10 @@ func Open(cfg Config) (*sql.DB, error) {
99
103
return nil , errors .New ("session is required" )
100
104
}
101
105
106
+ if cfg .WorkGroup == "" {
107
+ cfg .WorkGroup = "primary"
108
+ }
109
+
102
110
// This hack was copied from jackc/pgx. Sorry :(
103
111
// https://github.com/jackc/pgx/blob/70a284f4f33a9cc28fd1223f6b83fb00deecfe33/stdlib/sql.go#L130-L136
104
112
openFromSessionMutex .Lock ()
@@ -115,6 +123,7 @@ type Config struct {
115
123
Session * session.Session
116
124
Database string
117
125
OutputLocation string
126
+ WorkGroup string
118
127
119
128
PollFrequency time.Duration
120
129
}
@@ -138,6 +147,10 @@ func configFromConnectionString(connStr string) (*Config, error) {
138
147
139
148
cfg .Database = args .Get ("db" )
140
149
cfg .OutputLocation = args .Get ("output_location" )
150
+ cfg .WorkGroup = args .Get ("workgroup" )
151
+ if cfg .WorkGroup == "" {
152
+ cfg .WorkGroup = "primary"
153
+ }
141
154
142
155
frequencyStr := args .Get ("poll_frequency" )
143
156
if frequencyStr != "" {
0 commit comments