Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: try set the default schema to public (#14632)

h3n4l56506c76a4fa
diff --git a/backend/plugin/db/snowflake/snowflake.go b/backend/plugin/db/snowflake/snowflake.go
index 357dc6a6f0..f0e606f85e 100644
--- a/backend/plugin/db/snowflake/snowflake.go
+++ b/backend/plugin/db/snowflake/snowflake.go
@@ -287,6 +287,12 @@ func (driver *Driver) QueryConn(ctx context.Context, conn *sql.Conn, statement s
if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %s;", queryContext.Schema)); err != nil {
return nil, err
}
+ } else {
+ // If the queryContext.Schema is empty, we try to set the current schema to "PUBLIC" and ignore the error because
+ // the schema may not exist.
+ if _, err := conn.ExecContext(ctx, "USE SCHEMA PUBLIC;"); err != nil {
+ slog.Debug("failed to set schema to PUBLIC", log.BBError(err))
+ }
}
startTime := time.Now()