Skip to content

Commit d91e009

Browse files
[SNOW-1669514] Honor the Valuer/Stringer methods to resolve #1209 (#1211)
Co-authored-by: Piotr Fus <[email protected]>
1 parent 56beb83 commit d91e009

16 files changed

+484
-126
lines changed

.github/workflows/build-test.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
name: Build and Test
22

33
on:
4-
push:
5-
braches:
6-
- master
7-
tags:
8-
- v*
9-
pull_request:
10-
branches:
11-
- master
12-
- SNOW-*
13-
schedule:
14-
- cron: '7 3 * * *'
15-
workflow_dispatch:
16-
inputs:
17-
goTestParams:
18-
default:
19-
description: "Parameters passed to go test"
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
pull_request:
10+
branches:
11+
- master
12+
- SNOW-*
13+
schedule:
14+
- cron: '7 3 * * *'
15+
workflow_dispatch:
16+
inputs:
17+
goTestParams:
18+
default:
19+
description: 'Parameters passed to go test'
2020

2121
concurrency:
2222
# older builds for the same pull request numer or branch should be cancelled
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup go
3535
uses: actions/setup-go@v5
3636
with:
37-
go-version: '1.21'
37+
go-version-file: './go.mod'
3838
- name: golangci-lint
3939
uses: golangci/golangci-lint-action@v6
4040
with:

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea/
2+
.vscode/
23
parameters*.json
34
parameters*.bat
45
*.p8
@@ -11,6 +12,8 @@ wss-golang-agent.config
1112
wss-unified-agent.jar
1213
whitesource/
1314
*.swp
15+
cp.out
16+
__debug_bin*
1417

1518
# exclude vendor
1619
vendor

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ This driver currently does not support GCP regional endpoints. Please ensure tha
5656
Snowflake provides a set of sample programs to test with. Set the environment variable ``$GOPATH`` to the top directory of your workspace, e.g., ``~/go`` and make certain to
5757
include ``$GOPATH/bin`` in the environment variable ``$PATH``. Run the ``make`` command to build all sample programs.
5858

59-
```
59+
```sh
6060
make install
6161
```
6262

6363
In the following example, the program ``select1.go`` is built and installed in ``$GOPATH/bin`` and can be run from the command line:
6464

65-
```
65+
```sh
6666
SNOWFLAKE_TEST_ACCOUNT=<your_account> \
6767
SNOWFLAKE_TEST_USER=<your_user> \
6868
SNOWFLAKE_TEST_PASSWORD=<your_password> \
@@ -79,7 +79,7 @@ The developer notes are hosted with the source code on [GitHub](https://github.c
7979

8080
Set the Snowflake connection info in ``parameters.json``:
8181

82-
```
82+
```json
8383
{
8484
"testconnection": {
8585
"SNOWFLAKE_TEST_USER": "<your_user>",
@@ -88,21 +88,25 @@ Set the Snowflake connection info in ``parameters.json``:
8888
"SNOWFLAKE_TEST_WAREHOUSE": "<your_warehouse>",
8989
"SNOWFLAKE_TEST_DATABASE": "<your_database>",
9090
"SNOWFLAKE_TEST_SCHEMA": "<your_schema>",
91-
"SNOWFLAKE_TEST_ROLE": "<your_role>"
91+
"SNOWFLAKE_TEST_ROLE": "<your_role>",
92+
"SNOWFLAKE_TEST_DEBUG": "false"
9293
}
9394
}
9495
```
9596

9697
Install [jq](https://stedolan.github.io/jq) so that the parameters can get parsed correctly, and run ``make test`` in your Go development environment:
9798

98-
```
99+
```sh
99100
make test
100101
```
101102

103+
### Setting debug mode during tests
104+
This is for debugging Large SQL statements (greater than 300 characters). If you want to enable debug mode, set `SNOWFLAKE_TEST_DEBUG` to `true` in `parameters.json`, or export it in your shell instance.
105+
102106
## customizing Logging Tags
103107

104108
If you would like to ensure that certain tags are always present in the logs, `RegisterClientLogContextHook` can be used in your init function. See example below.
105-
```
109+
```go
106110
import "github.com/snowflakedb/gosnowflake"
107111

108112
func init() {
@@ -116,7 +120,7 @@ func init() {
116120

117121
## Setting Log Level
118122
If you want to change the log level, `SetLogLevel` can be used in your init function like this:
119-
```
123+
```go
120124
import "github.com/snowflakedb/gosnowflake"
121125

122126
func init() {
@@ -138,15 +142,15 @@ The following is a list of options you can pass in to set the level from least t
138142

139143
Configure your testing environment as described above and run ``make cov``. The coverage percentage will be printed on the console when the testing completes.
140144

141-
```
145+
```sh
142146
make cov
143147
```
144148

145149
For more detailed analysis, results are printed to ``coverage.txt`` in the project directory.
146150

147151
To read the coverage report, run:
148152

149-
```
153+
```sh
150154
go tool cover -html=coverage.txt
151155
```
152156

bind_uploader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func (bu *bindUploader) createStageIfNeeded() error {
118118
return (&SnowflakeError{
119119
Number: code,
120120
SQLState: data.Data.SQLState,
121-
Message: err.Error(),
121+
Message: data.Message,
122122
QueryID: data.Data.QueryID,
123123
}).exceptionTelemetry(bu.sc)
124124
}

0 commit comments

Comments
 (0)