This repo contains a Databricks SQL Driver for Go's database/sql package. It can be used to connect and query Databricks clusters and SQL Warehouses.
NOTE: This Driver is Beta.
Full documentation is not yet available. See below for usage examples.
import (
"database/sql"
"time"
_ "github.com/databricks/databricks-sql-go"
)
db, err := sql.Open("databricks", "token:********@********.databricks.com/sql/1.0/endpoints/********")
if err != nil {
panic(err)
}
rows, err := db.Query("SELECT 1")
Additional usage examples are available here.
The DSN format is:
token:[your token]@[Workspace hostname][Endpoint HTTP Path]?param=value
You can set query timeout value by appending a timeout
query parameter (in seconds) and you can set max rows to retrieve per network request by setting the maxRows
query parameter:
token:[your token]@[Workspace hostname][Endpoint HTTP Path]?timeout=1000&maxRows=1000
We use golangci-lint
as the lint tool. If you use vs code, just add the following settings:
{
"go.lintTool": "golangci-lint",
"go.lintFlags": [
"--fast"
]
}
go test
If you find any issues, feel free to create an issue or send a pull request directly.
See CONTRIBUTING.md