Skip to content

Commit

Permalink
chore: debug databricks logs for information schema columns
Browse files Browse the repository at this point in the history
  • Loading branch information
achettyiitr committed Aug 25, 2024
1 parent c21af4a commit f91530b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ require (
google.golang.org/api v0.189.0
)

replace github.com/gocql/gocql => github.com/scylladb/gocql v1.14.2 // fix for JetBrains IDEs

require (
cloud.google.com/go/auth v0.7.2 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.3 // indirect
Expand Down
7 changes: 7 additions & 0 deletions sqlconnect/internal/databricks/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import (
"encoding/json"
"fmt"
"strings"
"time"

databricks "github.com/databricks/databricks-sql-go"
"github.com/google/uuid"
"github.com/samber/lo"

"github.com/rudderlabs/sqlconnect-go/sqlconnect"
Expand Down Expand Up @@ -60,9 +62,14 @@ func NewDB(configJson json.RawMessage) (*DB, error) {
db := sql.OpenDB(connector)
db.SetConnMaxIdleTime(config.MaxConnIdleTime)

id := uuid.New().String()
startTime := time.Now()
fmt.Println("checking if information schema is available", " ID: ", id)
if _, err = db.Exec("SELECT * FROM INFORMATION_SCHEMA.COLUMNS LIMIT 1"); err != nil && !strings.Contains(err.Error(), "TABLE_OR_VIEW_NOT_FOUND") {
fmt.Println("error checking if information schema is available.", " Took: ", time.Since(startTime), " Error: ", err, " ID: ", id)
return nil, fmt.Errorf("checking if unity catalog is available: %w", err)
}
fmt.Println("information schema is available", " Took: ", time.Since(startTime), " ID: ", id)
informationSchema := err == nil

return &DB{
Expand Down

0 comments on commit f91530b

Please sign in to comment.