Skip to content

Commit 1778740

Browse files
committed
add comment for usage of Result Mode, and fix the parameter.
1 parent ced3985 commit 1778740

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Note
5555
- DL and GZIP DL Mode are used only in the Select statement.
5656
- Other statements automatically use API mode under DL or GZIP DL Mode.
5757
- Detailed explanation is described [here](doc/result_mode.md).
58+
- [Usages of Result Mode](doc/result_mode.md#usages).
5859

5960
## Testing
6061

doc/result_mode.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,31 @@ It is a comparison of the time taken from executing the query in the actual resu
6464
I think the following trends can be said.
6565
- DL mode and API mode are effective for a small number of cases
6666
- GZIP DL mode is very effective for a large number of cases
67+
68+
## Usages
69+
70+
### Setting in Configuration
71+
72+
```
73+
# DL Mode
74+
db, err := sql.Open("athena", "db=xxxx&output_location=s3://xxxxxxx&region=xxxxxx&result_mode=dl")
75+
76+
# GZIP DL Mode
77+
db, err := sql.Open("athena", "db=xxxx&output_location=s3://xxxxxxx&region=xxxxxx&result_mode=gzip")
78+
```
79+
80+
### Setting in Context
81+
82+
You can change the Result Mode for each SQL.
83+
Settings in context override Configuration settings.
84+
85+
```
86+
# API Mode
87+
ctx = SetAPIMode(ctx)
88+
89+
# DL Mode
90+
ctx = SetDLMode(ctx)
91+
92+
# GZIP DL Mode
93+
ctx = SetGzipDLMode(ctx)
94+
```

driver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func configFromConnectionString(connStr string) (*Config, error) {
176176
}
177177

178178
cfg.ResultMode = ResultModeAPI
179-
modeValue := strings.ToLower(args.Get("mode"))
179+
modeValue := strings.ToLower(args.Get("result_mode"))
180180
switch {
181181
case modeValue == "dl" || modeValue == "download":
182182
cfg.ResultMode = ResultModeDL

0 commit comments

Comments
 (0)