Skip to content

Commit

Permalink
try openconnector
Browse files Browse the repository at this point in the history
  • Loading branch information
hrl20 committed Apr 28, 2024
1 parent d20bfad commit eb6968c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/plugin/duckdb_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/grafana/grafana-plugin-sdk-go/data"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
"github.com/grafana/sqlds/v3"
_ "github.com/marcboeker/go-duckdb"
"github.com/marcboeker/go-duckdb"
"github.com/motherduck/duckdb-datasource/pkg/models"
)

Expand Down Expand Up @@ -71,12 +71,16 @@ func (d *DuckDBDriver) Connect(ctx context.Context, settings backend.DataSourceI
// Join all parts with '&' to form the final query string
// queryString := strings.Join(parts, "&")
// dbString := strings.Join([]string{dbPath, queryString}, "?")
log.Default().Printf("Connecting to DuckDB with %s..\n", config.Path)
db, err := sql.Open("duckdb", config.Path)
log.Default().Printf("Connecting to DuckDB with %s\n", config.Path)
driver := duckdb.Driver{}
connector, err := driver.OpenConnector(config.Path)

if err != nil {
return nil, err
}

db := sql.OpenDB(connector)

return db, nil
}

Expand Down

0 comments on commit eb6968c

Please sign in to comment.