-
Notifications
You must be signed in to change notification settings - Fork 173
Closed
Labels
Type: bugSomething isn't workingSomething isn't working
Milestone
Description
What happened?
When getting objects at either ObjectDepthColumns or ObjectDepthAll, with all the necessary table information (catalog, schema, table):
rr, err := cnxn.GetObjects(ctx, adbc.ObjectDepthColumns, &catalog, &schema, &table, nil, nil)
if err != nil {
return err
}If no schema is set with either snowflake.OptionSchema or executing USE SCHEMA <name> query, the following error is returned:
I/O: [Snowflake] Internal query returned wrong type of value: %!s(<nil>)
This looks to be due to SELECT CURRENT_SCHEMA() returning nullish in the call to GetCurrentDbSchema in the below code. Can't the schema name passed to the function call be used in case it is present?
arrow-adbc/go/adbc/driver/snowflake/connection.go
Lines 321 to 343 in 11e1681
| // currently only the Columns / all case still requires a current database/schema | |
| // to be propagated. The rest of the cases all solely use SHOW queries for the metadata | |
| // just as done by the snowflake JDBC driver. In those cases we don't need to propagate | |
| // the current session database/schema. | |
| if depth == adbc.ObjectDepthColumns || depth == adbc.ObjectDepthAll { | |
| dbname, err := c.GetCurrentCatalog() | |
| if err != nil { | |
| return nil, errToAdbcErr(adbc.StatusIO, err) | |
| } | |
| schemaname, err := c.GetCurrentDbSchema() | |
| if err != nil { | |
| return nil, errToAdbcErr(adbc.StatusIO, err) | |
| } | |
| // the connection that is used is not the same connection context where the database may have been set | |
| // if the caller called SetCurrentCatalog() so need to ensure the database context is appropriate | |
| multiCtx, _ := gosnowflake.WithMultiStatement(ctx, 2) | |
| _, err = conn.ExecContext(multiCtx, fmt.Sprintf("USE DATABASE %s; USE SCHEMA %s;", quoteTblName(dbname), quoteTblName(schemaname))) | |
| if err != nil { | |
| return nil, errToAdbcErr(adbc.StatusIO, err) | |
| } | |
| } |
Stack Trace
No response
How can we reproduce the bug?
No response
Environment/Setup
No response
Metadata
Metadata
Assignees
Labels
Type: bugSomething isn't workingSomething isn't working