Open AdamDrewsTR opened 1 month ago
It treats a UUID as an array, which makes sense. It is an alias for an array of bytes that can be written as a string: https://go.dev/play/p/D8KVUFx1M_z
hi - thanks for filing this issue with us. do i gather correctly this issue doesn't happen when you use v1.10.1 of the driver, only after upgrading to v1.11.1 ? if so, do you think you could provide a reproduce program or even a code snippet which is representative of what you're doing , for us to try and reproduce ?
thank you in advance if that's possible
in the meantime, i found your account and query details, and i indeed see that with v1.10.1 of the driver, the binding was sent like {"type":"TEXT","value":"45cc10be-1417-47c2-8814-f3d82940131c"}
, and after v1.11.1 , it's send as {"type":"TEXT","value":"\"51d3526b-bf57-46bb-8258-1344e6e8d910\"","fmt":"json"}
i tried to guess how exactly you're approaching the generation of the bind data and passing it to Snowflake, and using this simplistic attempt to repro:
# cat main.go
package main
import (
//uuid "github.com/google/uuid"
"context"
"database/sql"
"fmt"
"log"
sf "github.com/snowflakedb/gosnowflake"
)
type myUuid struct {
uuid string
}
func newUuid(inUuid string) *myUuid {
n := myUuid{uuid: inUuid}
return &n
}
func main() {
u := "cc95f80a-cf6a-45c2-91ea-a053aa29592f"
res := newUuid(u)
cfg, err := sf.GetConfigFromEnv([]*sf.ConfigParam{
{Name: "Account", EnvName: "SNOWFLAKE_TEST_ACCOUNT", FailOnMissing: true},
{Name: "User", EnvName: "SNOWFLAKE_TEST_USER", FailOnMissing: true},
{Name: "Password", EnvName: "SNOWFLAKE_TEST_PASSWORD", FailOnMissing: true},
})
cfg.Tracing = "TRACE"
cfg.InsecureMode = true
if err != nil {
log.Fatalf("failed to create Config, err: %v", err)
}
dsn, err := sf.DSN(cfg)
if err != nil {
log.Fatalf("failed to create DSN from Config: %v, err: %v", cfg, err)
}
db, err := sql.Open("snowflake", dsn)
if err != nil {
log.Fatalf("failed to connect. %v, err: %v", dsn, err)
}
defer db.Close()
ctx := context.Background()
conn, err := db.Conn(ctx)
if err != nil {
log.Fatalf("Failed to acquire connection. err: %v", err)
}
defer conn.Close()
query := "update test_db.go.issue1209 set is_read = ? where id in (?); "
_, err = conn.ExecContext(ctx, query, false, sf.Array(res))
if err != nil {
log.Fatalf("failed to run a query. %v, err: %v", query, err)
}
fmt.Printf("Congrats! You have successfully run %v with Snowflake DB!\n", query)
}
but since it ends up with
2024/09/19 08:12:48 failed to run a query. update test_db.go.issue1209 set is_read = ? where id in (?); , err: sql: converting argument $2 type: unsupported type main.myUuid, a struct
i'm obviously missing at least one, possibly more steps.
So it would be highly helpful if you could share how you're generating and passing the input data into the bindings and how you use the struct here. Thank you in advance !
@sfc-gh-dszmolka It is more like below where the google uuid.UUID is the struct type, and the column is declared as a varchar in Snowflake. When binding, the raw uuid.UUID values were passed in. Previously those uuid.UUIDs had been converted to strings, but with the recent changes they are treated like arrays. There is this line in the logs that is comming from arrayToString: *`DEBU[0001]log.go:176 gosnowflake.(defaultLogger).Debugf TYPE: uuid.UUID, 31c9364b-cbef-4054-80b2-985cb0fa5d45`.**
type myUuid struct {
id uuid.UUID
}
query := "update TESTING_TABLE set is_read = ? where id = ?; "
theId, _ := uuid.Parse("31c9364b-cbef-4054-80b2-985cb0fa5d45")
_, err = conn.ExecContext(ctx, query, true, theId)
if err != nil {
log.Fatalf("failed to run a query. %v, err: %v", query, err)
}
Output:
INFO[0000]driver.go:38 gosnowflake.SnowflakeDriver.OpenWithConfig OpenWithConfig
INFO[0000]log.go:182 gosnowflake.(*defaultLogger).Infof Trying to initialize Easy Logging
DEBU[0000]log.go:176 gosnowflake.(*defaultLogger).Debugf No client config found in directory: /var/folders/57/3wg0hdrn19g4r32_pyr6rqmc0000gq/T/go-build1336869291/b001/exe
DEBU[0000]log.go:176 gosnowflake.(*defaultLogger).Debugf No client config found in directory: /Users/adam
INFO[0000]log.go:244 gosnowflake.(*defaultLogger).Info No client config file found in default directories
INFO[0000]log.go:244 gosnowflake.(*defaultLogger).Info Easy Logging is disabled as no config has been found
INFO[0000]driver.go:47 gosnowflake.SnowflakeDriver.OpenWithConfig Connecting to GLOBAL Snowflake domain
INFO[0000]auth.go:540 gosnowflake.authenticateWithConfig Authenticating via SNOWFLAKE
INFO[0000]auth.go:356 gosnowflake.authenticate PARAMS for Auth: &map[databaseName:[DB_QA] roleName:[DBROLE] schemaName:{SNIP}
INFO[0000]retry.go:299 gosnowflake.(*retryHTTP).execute retryHTTP.totalTimeout: 30s
DEBU[0000]retry.go:309 gosnowflake.(*retryHTTP).execute retry count: 0
INFO[0000]auth.go:446 gosnowflake.createRequestBody Username and password
INFO[0001]auth.go:383 gosnowflake.authenticate Authentication SUCCESS
INFO[0001]connection_util.go:164 gosnowflake.(*snowflakeConn).populateSessionParameters params: []gosnowflake.nameValueParameter{gosnowflake.nameValueParameter{Name:"TIMESTAMP_OUTPUT_FORMAT", Value:"YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM"}, gosnowflake.nameValueParameter{Name:"CLIENT_PREFETCH_THREADS", Value:4}, gosnowflake.nameValueParameter{Name:"TIME_OUTPUT_FORMAT", Value:"HH24:MI:SS"}, gosnowflake.nameValueParameter{Name:"TIMESTAMP_TZ_OUTPUT_FORMAT", Value:""}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_CHUNK_SIZE", Value:160}, gosnowflake.nameValueParameter{Name:"CLIENT_SESSION_KEEP_ALIVE", Value:false}, gosnowflake.nameValueParameter{Name:"QUERY_CONTEXT_CACHE_SIZE", Value:5}, gosnowflake.nameValueParameter{Name:"CLIENT_METADATA_USE_SESSION_DATABASE", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_OUT_OF_BAND_TELEMETRY_ENABLED", Value:false}, gosnowflake.nameValueParameter{Name:"ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1", Value:false}, gosnowflake.nameValueParameter{Name:"TIMESTAMP_NTZ_OUTPUT_FORMAT", Value:"YYYY-MM-DD HH24:MI:SS.FF3"}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_PREFETCH_THREADS", Value:1}, gosnowflake.nameValueParameter{Name:"CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_HONOR_CLIENT_TZ_FOR_TIMESTAMP_NTZ", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_MEMORY_LIMIT", Value:1536}, gosnowflake.nameValueParameter{Name:"CLIENT_TIMESTAMP_TYPE_MAPPING", Value:"TIMESTAMP_LTZ"}, gosnowflake.nameValueParameter{Name:"TIMEZONE", Value:"America/Los_Angeles"}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_PREFETCH_SLOTS", Value:2}, gosnowflake.nameValueParameter{Name:"CLIENT_TELEMETRY_ENABLED", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_USE_V1_QUERY_API", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_DISABLE_INCIDENTS", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_COLUMN_CASE_INSENSITIVE", Value:false}, gosnowflake.nameValueParameter{Name:"CSV_TIMESTAMP_FORMAT", Value:""}, gosnowflake.nameValueParameter{Name:"BINARY_OUTPUT_FORMAT", Value:"HEX"}, gosnowflake.nameValueParameter{Name:"CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_TELEMETRY_SESSIONLESS_ENABLED", Value:true}, gosnowflake.nameValueParameter{Name:"DATE_OUTPUT_FORMAT", Value:"YYYY-MM-DD"}, gosnowflake.nameValueParameter{Name:"CLIENT_CONSENT_CACHE_ID_TOKEN", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_FORCE_PROTECT_ID_TOKEN", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_STAGE_ARRAY_BINDING_THRESHOLD", Value:65280}, gosnowflake.nameValueParameter{Name:"CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY", Value:3600}, gosnowflake.nameValueParameter{Name:"AUTOCOMMIT", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_SESSION_CLONE", Value:false}, gosnowflake.nameValueParameter{Name:"TIMESTAMP_LTZ_OUTPUT_FORMAT", Value:""}}
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_OUTPUT_FORMAT, value: YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_PREFETCH_THREADS, value: 4
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIME_OUTPUT_FORMAT, value: HH24:MI:SS
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_TZ_OUTPUT_FORMAT, value:
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_CHUNK_SIZE, value: 160
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_SESSION_KEEP_ALIVE, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: QUERY_CONTEXT_CACHE_SIZE, value: 5
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_METADATA_USE_SESSION_DATABASE, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_OUT_OF_BAND_TELEMETRY_ENABLED, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_NTZ_OUTPUT_FORMAT, value: YYYY-MM-DD HH24:MI:SS.FF3
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_PREFETCH_THREADS, value: 1
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_HONOR_CLIENT_TZ_FOR_TIMESTAMP_NTZ, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_MEMORY_LIMIT, value: 1536
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_TIMESTAMP_TYPE_MAPPING, value: TIMESTAMP_LTZ
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMEZONE, value: America/Los_Angeles
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_PREFETCH_SLOTS, value: 2
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_TELEMETRY_ENABLED, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_USE_V1_QUERY_API, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_DISABLE_INCIDENTS, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_COLUMN_CASE_INSENSITIVE, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CSV_TIMESTAMP_FORMAT, value:
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: BINARY_OUTPUT_FORMAT, value: HEX
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_TELEMETRY_SESSIONLESS_ENABLED, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: DATE_OUTPUT_FORMAT, value: YYYY-MM-DD
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_CONSENT_CACHE_ID_TOKEN, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_FORCE_PROTECT_ID_TOKEN, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_STAGE_ARRAY_BINDING_THRESHOLD, value: 65280
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY, value: 3600
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: AUTOCOMMIT, value: true
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_SESSION_CLONE, value: false
DEBU[0001]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_LTZ_OUTPUT_FORMAT, value:
DEBU[0001]log.go:176 gosnowflake.(*defaultLogger).Debugf sending 1 logs to telemetry. inband telemetry payload being sent: {"logs":[{"timestamp":1726755900128,"message":{"DriverType":"Go","DriverVersion":"1.11.1","GolangVersion":"go1.22.2","autocommit":"true","binary_output_format":"HEX","client_consent_cache_id_token":"false","client_disable_incidents":"true","client_enable_log_info_statement_parameters":"false","client_force_protect_id_token":"true","client_honor_client_tz_for_timestamp_ntz":"true","client_memory_limit":"1536","client_metadata_request_use_connection_ctx":"false","client_metadata_use_session_database":"false","client_out_of_band_telemetry_enabled":"false","client_prefetch_threads":"4","client_result_chunk_size":"160","client_result_column_case_insensitive":"false","client_result_prefetch_slots":"2","client_result_prefetch_threads":"1","client_session_clone":"false","client_session_keep_alive":"false","client_session_keep_alive_heartbeat_frequency":"3600","client_stage_array_binding_threshold":"65280","client_telemetry_enabled":"true","client_telemetry_sessionless_enabled":"true","client_timestamp_type_mapping":"TIMESTAMP_LTZ","client_use_v1_query_api":"true","csv_timestamp_format":"","date_output_format":"YYYY-MM-DD","enable_stage_s3_privatelink_for_us_east_1":"false","query_context_cache_size":"5","source":"golang_driver","time_output_format":"HH24:MI:SS","timestamp_ltz_output_format":"","timestamp_ntz_output_format":"YYYY-MM-DD HH24:MI:SS.FF3","timestamp_output_format":"YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM","timestamp_tz_output_format":"","timezone":"America/Los_Angeles","type":"client_connection_parameters"}}]}
INFO[0001]retry.go:299 gosnowflake.(*retryHTTP).execute retryHTTP.totalTimeout: 10s
DEBU[0001]retry.go:309 gosnowflake.(*retryHTTP).execute retry count: 0
DEBU[0001]log.go:238 gosnowflake.(*defaultLogger).Debug successfully uploaded metrics to telemetry
INFO[0001]connection.go:312 gosnowflake.(*snowflakeConn).ExecContext Exec: "update TESTING_TABLE set is_read = ? where id = ?; ", [{ 1 true} { 2 31c9364b-cbef-4054-80b2-985cb0fa5d45}]
DEBU[0001]log.go:176 gosnowflake.(*defaultLogger).Debugf empty qcc
INFO[0001]connection.go:117 gosnowflake.(*snowflakeConn).exec parameters: map[]
DEBU[0001]log.go:176 gosnowflake.(*defaultLogger).Debugf TYPE: bool, true
DEBU[0001]log.go:176 gosnowflake.(*defaultLogger).Debugf TYPE: uuid.UUID, 31c9364b-cbef-4054-80b2-985cb0fa5d45
INFO[0001]connection.go:126 gosnowflake.(*snowflakeConn).exec bindings: map[1:{BOOLEAN 0x14000e81f60 <nil>} 2:{TEXT 0x14000dc4090 json <nil>}]
INFO[0001]restful.go:236 gosnowflake.postRestfulQueryHelper params: &map[]
INFO[0001]retry.go:299 gosnowflake.(*retryHTTP).execute retryHTTP.totalTimeout: 0s
DEBU[0001]retry.go:309 gosnowflake.(*retryHTTP).execute retry count: 0
INFO[0002]restful.go:253 gosnowflake.postRestfulQueryHelper postQuery: resp: &{200 OK 200 HTTP/1.1 1 1 map[Cache-Control:[no-cache, no-store] Connection:[keep-alive] Content-Type:[application/json] Date:[Thu, 19 Sep 2024 14:25:01 GMT] Expect-Ct:[enforce, max-age=3600] Strict-Transport-Security:[max-age=31536000] Vary:[Accept-Encoding, User-Agent] X-Content-Type-Options:[nosniff] X-Country:[United States] X-Frame-Options:[deny] X-Xss-Protection:[1; mode=block]] 0x140006a4820 -1 [] false true map[] 0x14000ea7200 0x140012f60b0}
INFO[0002]connection.go:156 gosnowflake.(*snowflakeConn).exec Success: true, Code: -1
DEBU[0002]log.go:176 gosnowflake.(*defaultLogger).Debugf adding query context: {0 1726755901299437 0 }
INFO[0002]connection.go:190 gosnowflake.(*snowflakeConn).exec Exec/Query SUCCESS
INFO[0002]connection_util.go:164 gosnowflake.(*snowflakeConn).populateSessionParameters params: []gosnowflake.nameValueParameter{gosnowflake.nameValueParameter{Name:"TIMESTAMP_OUTPUT_FORMAT", Value:"YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM"}, gosnowflake.nameValueParameter{Name:"CLIENT_PREFETCH_THREADS", Value:4}, gosnowflake.nameValueParameter{Name:"TIME_OUTPUT_FORMAT", Value:"HH24:MI:SS"}, gosnowflake.nameValueParameter{Name:"TIMESTAMP_TZ_OUTPUT_FORMAT", Value:""}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_CHUNK_SIZE", Value:160}, gosnowflake.nameValueParameter{Name:"CLIENT_SESSION_KEEP_ALIVE", Value:false}, gosnowflake.nameValueParameter{Name:"QUERY_CONTEXT_CACHE_SIZE", Value:5}, gosnowflake.nameValueParameter{Name:"CLIENT_METADATA_USE_SESSION_DATABASE", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_OUT_OF_BAND_TELEMETRY_ENABLED", Value:false}, gosnowflake.nameValueParameter{Name:"ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1", Value:false}, gosnowflake.nameValueParameter{Name:"TIMESTAMP_NTZ_OUTPUT_FORMAT", Value:"YYYY-MM-DD HH24:MI:SS.FF3"}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_PREFETCH_THREADS", Value:1}, gosnowflake.nameValueParameter{Name:"CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_HONOR_CLIENT_TZ_FOR_TIMESTAMP_NTZ", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_MEMORY_LIMIT", Value:1536}, gosnowflake.nameValueParameter{Name:"CLIENT_TIMESTAMP_TYPE_MAPPING", Value:"TIMESTAMP_LTZ"}, gosnowflake.nameValueParameter{Name:"TIMEZONE", Value:"America/Los_Angeles"}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_PREFETCH_SLOTS", Value:2}, gosnowflake.nameValueParameter{Name:"CLIENT_TELEMETRY_ENABLED", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_USE_V1_QUERY_API", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_DISABLE_INCIDENTS", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_RESULT_COLUMN_CASE_INSENSITIVE", Value:false}, gosnowflake.nameValueParameter{Name:"CSV_TIMESTAMP_FORMAT", Value:""}, gosnowflake.nameValueParameter{Name:"BINARY_OUTPUT_FORMAT", Value:"HEX"}, gosnowflake.nameValueParameter{Name:"CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_TELEMETRY_SESSIONLESS_ENABLED", Value:true}, gosnowflake.nameValueParameter{Name:"DATE_OUTPUT_FORMAT", Value:"YYYY-MM-DD"}, gosnowflake.nameValueParameter{Name:"CLIENT_CONSENT_CACHE_ID_TOKEN", Value:false}, gosnowflake.nameValueParameter{Name:"CLIENT_FORCE_PROTECT_ID_TOKEN", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_STAGE_ARRAY_BINDING_THRESHOLD", Value:65280}, gosnowflake.nameValueParameter{Name:"CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY", Value:3600}, gosnowflake.nameValueParameter{Name:"AUTOCOMMIT", Value:true}, gosnowflake.nameValueParameter{Name:"CLIENT_SESSION_CLONE", Value:false}, gosnowflake.nameValueParameter{Name:"TIMESTAMP_LTZ_OUTPUT_FORMAT", Value:""}} LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_OUTPUT_FORMAT, value: YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_PREFETCH_THREADS, value: 4 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIME_OUTPUT_FORMAT, value: HH24:MI:SS LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_TZ_OUTPUT_FORMAT, value: LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_CHUNK_SIZE, value: 160 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_SESSION_KEEP_ALIVE, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: QUERY_CONTEXT_CACHE_SIZE, value: 5 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_METADATA_USE_SESSION_DATABASE, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_OUT_OF_BAND_TELEMETRY_ENABLED, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_NTZ_OUTPUT_FORMAT, value: YYYY-MM-DD HH24:MI:SS.FF3 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_PREFETCH_THREADS, value: 1 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_HONOR_CLIENT_TZ_FOR_TIMESTAMP_NTZ, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_MEMORY_LIMIT, value: 1536 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_TIMESTAMP_TYPE_MAPPING, value: TIMESTAMP_LTZ LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMEZONE, value: America/Los_Angeles LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_PREFETCH_SLOTS, value: 2 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_TELEMETRY_ENABLED, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_USE_V1_QUERY_API, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_DISABLE_INCIDENTS, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_RESULT_COLUMN_CASE_INSENSITIVE, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CSV_TIMESTAMP_FORMAT, value: LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: BINARY_OUTPUT_FORMAT, value: HEX LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_TELEMETRY_SESSIONLESS_ENABLED, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: DATE_OUTPUT_FORMAT, value: YYYY-MM-DD LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_CONSENT_CACHE_ID_TOKEN, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_FORCE_PROTECT_ID_TOKEN, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_STAGE_ARRAY_BINDING_THRESHOLD, value: 65280 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY, value: 3600 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: AUTOCOMMIT, value: true LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: CLIENT_SESSION_CLONE, value: false LOG_SESSION_ID=4974753626156026
DEBU[0002]connection_util.go:185 gosnowflake.(*snowflakeConn).populateSessionParameters parameter. name: TIMESTAMP_LTZ_OUTPUT_FORMAT, value: LOG_SESSION_ID=4974753626156026
DEBU[0002]connection.go:349 gosnowflake.(*snowflakeConn).ExecContext number of updated rows: 0
Congrats! You have successfully run update TESTING_TABLE set is_read = ? where id = ?; with Snowflake DB!
INFO[0002]connection.go:279 gosnowflake.(*snowflakeConn).Close Close LOG_SESSION_ID=4974753626156026
DEBU[0002]log.go:238 gosnowflake.(*defaultLogger).Debug nothing to send to telemetry
INFO[0002]restful.go:327 gosnowflake.closeSession close session LOG_SESSION_ID=4974753626156026
INFO[0002]retry.go:299 gosnowflake.(*retryHTTP).execute retryHTTP.totalTimeout: 5s LOG_SESSION_ID=4974753626156026
DEBU[0002]retry.go:309 gosnowflake.(*retryHTTP).execute retry count: 0 LOG_SESSION_ID=4974753626156026
DEBU[0002]connection.go:270 gosnowflake.(*snowflakeConn).cleanup Snowflake connection closing. LOG_SESSION_ID=4974753626156026
You'll also see that if you change the UUID to a string, it will update the row:
_, err = conn.ExecContext(ctx, query, true, theId.String())
Updating this: https://go.dev/play/p/iLBnvDe-3ES
My colleague also just pointed out that uuid.UUID implements Valuer that returns the db.Value back; that isn't being honored anymore. https://pkg.go.dev/database/sql/driver#Valuer
Opened PR to try and solve this. It should work for both your UUID package and the google's uuid.UUID package.
@sfc-gh-dszmolka I pinged Mike Wies as he is our enterprise support technical person. Hoping to get some eyes on PR #1211
great, thank you @AdamDrewsTR for the details and @ChronosMasterOfAllTime for the contribution here !
great, thank you @AdamDrewsTR for the details and @ChronosMasterOfAllTime for the contribution here !
@sfc-gh-dszmolka Anytime; how do you run the tests locally without setting SKIP_TESTS
?
Tests do not run automatically when submitted from external contributors. We'll take a look once we get there and take care of the PR and fix. Again, thank you for your contribution!
Please answer these questions before submitting your issue. In order to accurately debug the issue this information is required. Thanks!
What version of GO driver are you using? 1.11.1
What operating system and processor architecture are you using? Mac, Linux x64 amd and m1
What version of GO are you using? 1.22.7
4.Server version:* E.g. 1.90.1 8.34.0
What did you do? Updated from 10.1 to 11.1.
What did you expect to see? Values updated when using an in clause containing a struct that IS a string. We also had to implement a custom serializer to convert UUIDs to strings prior to making their way to sql. It seems like String() isn't honored anymore on struct?
Binding array of structs in a query's IN clause should return results. It seems like something is getting double escaped somewhere. We are using google's UUIDs which would resolve as an driver.Value of array b/c it's driver value is a string. This results in it flowing throug converter.arrayToString: [SAM CLI:59345] time="2024-09-17T21:03:11Z" level=debug msg="TYPE: uuid.UUID, 51d3526b-bf57-46bb-8258-1344e6e8d910" func="gosnowflake.(*defaultLogger).Debugf" file="log.go:176"
When I run the UUID through arrayToString I get a bingingValue of json, and the value is a quoted string: {0x1400022b640 json}
"49dbf3b3-7a72-42f2-9183-d6e24d00f292"
Is this then getting double escaped somewhere because it thinks the string is json?
What should have happened and what happened instead? Queries find the value by string.
Can you set logging to DEBUG and collect the logs? [SAM CLI:59345] time="2024-09-17T21:03:11Z" level=info msg="Exec: \"UPDATE \\"some_table\\" SET \\"is_read\\"=? WHERE \\"id\\" IN (?) AND \\"some_table\\".\\"deleted_at\\" IS NULL AND \\"user_id\\" = ?\", [{ 1 true} { 2 51d3526b-bf57-46bb-8258-1344e6e8d910} { 3 _USERID}]" func="gosnowflake.(*snowflakeConn).ExecContext" file="connection.go:312"
What is your Snowflake account identifier, if any? (Optional)