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 23, 2024
1 parent c21af4a commit 56984d0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sqlconnect/internal/databricks/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import (
"database/sql"
"encoding/json"
"fmt"
"log"
"os"
"strings"
"time"

databricks "github.com/databricks/databricks-sql-go"
"github.com/samber/lo"
Expand Down Expand Up @@ -60,9 +63,15 @@ func NewDB(configJson json.RawMessage) (*DB, error) {
db := sql.OpenDB(connector)
db.SetConnMaxIdleTime(config.MaxConnIdleTime)

l := log.New(os.Stdout, "databricks", log.LstdFlags)

startTime := time.Now()
l.Println("Checking if information schema is available")
if _, err = db.Exec("SELECT * FROM INFORMATION_SCHEMA.COLUMNS LIMIT 1"); err != nil && !strings.Contains(err.Error(), "TABLE_OR_VIEW_NOT_FOUND") {
l.Println("Error checking if information schema is available: ", err)

Check warning on line 71 in sqlconnect/internal/databricks/db.go

View check run for this annotation

Codecov / codecov/patch

sqlconnect/internal/databricks/db.go#L71

Added line #L71 was not covered by tests
return nil, fmt.Errorf("checking if unity catalog is available: %w", err)
}
l.Println("Information schema is available: ", time.Since(startTime))
informationSchema := err == nil

return &DB{
Expand Down

0 comments on commit 56984d0

Please sign in to comment.