Closed zeroshade closed 3 weeks ago
CC @davidhcoe Can you confirm that this fixes the issue reported?
This doesn't work for me. I put together a sample to test with based on the result I get from Snowflake: sf_results.json
func (suite *SnowflakeTests) TestJsonUnmarshal() {
jsonFile, err := os.Open("sf_results.json")
if err != nil {
log.Fatal("Failed to open file:", err)
}
defer jsonFile.Close()
byteValue, err := ioutil.ReadAll(jsonFile)
var getObjectsCatalog driverbase.GetObjectsInfo
if err := json.Unmarshal(byteValue, &getObjectsCatalog); err != nil {
log.Fatal("Failed to parse JSON:", err)
}
for i, sch := range getObjectsCatalog.CatalogDbSchemas {
for j, tab := range sch.DbSchemaTables {
for k, con := range tab.TableConstraints {
for l, _ := range con.ConstraintColumnNames {
fmt.Println(getObjectsCatalog.CatalogDbSchemas[i].DbSchemaTables[j].TableConstraints[k].ConstraintColumnNames[l])
}
}
}
}
}
@davidhcoe I've updated the PR and added a test based on your example. Can you confirm it works for you?
Yes -- it works for me now. Thank you.
Fixes #2278
The current
UnmarshalJSON
function forrequiredList
ended up unmarshalling into a copy of the underlying slice rather than using the actual slice, so the data wasn't being propagated appropriately. This fixes theUnmarshalJSON
function to handle the scenario appropriately.