diff --git a/cmd/go-duckdb-helper/go.mod b/cmd/preinstall-extensions/go.mod similarity index 90% rename from cmd/go-duckdb-helper/go.mod rename to cmd/preinstall-extensions/go.mod index ccf6e99..faf5859 100644 --- a/cmd/go-duckdb-helper/go.mod +++ b/cmd/preinstall-extensions/go.mod @@ -1,4 +1,4 @@ -module github.com/motherduckdb/grafana-duckdb-datasource/cmd/go-duckdb-helper +module github.com/motherduckdb/grafana-duckdb-datasource/cmd/preinstall-extensions go 1.23 diff --git a/cmd/go-duckdb-helper/go.sum b/cmd/preinstall-extensions/go.sum similarity index 100% rename from cmd/go-duckdb-helper/go.sum rename to cmd/preinstall-extensions/go.sum diff --git a/cmd/go-duckdb-helper/main.go b/cmd/preinstall-extensions/main.go similarity index 77% rename from cmd/go-duckdb-helper/main.go rename to cmd/preinstall-extensions/main.go index 8061e77..de92b10 100644 --- a/cmd/go-duckdb-helper/main.go +++ b/cmd/preinstall-extensions/main.go @@ -1,3 +1,8 @@ +// From https://github.com/snakedotdev/grafana-duckdb-datasource +// Apache 2.0 Licensed +// Copyright snakedotdev +// Modified from original version + package main import ( @@ -13,8 +18,8 @@ import ( func main() { var ( - sqlCmd = flag.String("s", "", "SQL command to execute (multiple commands can be separated by semicolons)") - dbPath = flag.String("db", "", "Path to DuckDB database file (empty for in-memory)") + sqlCmd = flag.String("s", "", "SQL command to execute (multiple commands can be separated by semicolons)") + dbPath = flag.String("db", "", "Path to DuckDB database file (empty for in-memory)") ) flag.Parse() @@ -65,4 +70,4 @@ func main() { } fmt.Println("All commands executed successfully") -} +} diff --git a/pkg/plugin/duckdb_driver.go b/pkg/plugin/duckdb_driver.go index f6c6a78..c3c9429 100644 --- a/pkg/plugin/duckdb_driver.go +++ b/pkg/plugin/duckdb_driver.go @@ -57,36 +57,6 @@ func (d *DuckDBDriver) Connect(ctx context.Context, settings backend.DataSourceI os.Setenv("motherduck_token", config.Secrets.MotherDuckToken) } - // // join config as url parmaeters - // config, err := parseConfig(settings) - - // if err != nil { - // return nil, err - // } - - // // Create a slice to hold the URL-encoded key-value pairs - // var parts []string - // var dbPath string - // // Iterate through the map - // for key, value := range config { - // if key == "path" { - // dbPath = value - // continue - // } else if key == "apiKey" { - // } - - // // URL-encode the key and the value - // encodedKey := url.QueryEscape(key) - // encodedValue := url.QueryEscape(value) - - // // Append the encoded key-value pair to the slice - // parts = append(parts, fmt.Sprintf("%s=%s", encodedKey, encodedValue)) - // } - - // Join all parts with '&' to form the final query string - // queryString := strings.Join(parts, "&") - // dbString := strings.Join([]string{dbPath, queryString}, "?") - connector, err := duckdb.NewConnector(config.Path, func(execer driver.ExecerContext) error { bootQueries := []string{}