Categorygithub.com/databricks/databricks-sql-go
modulepackage
0.2.2
Repository: https://github.com/databricks/databricks-sql-go.git
Documentation: pkg.go.dev

# README

Databricks SQL Driver for Go (Beta)

http://www.apache.org/licenses/LICENSE-2.0.txt

Description

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.

Documentation

Full documentation is not yet available. See below for usage examples.

Usage

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.

DSN (Data Source Name)

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

Develop

Lint

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"
    ]
}

Unit Tests

go test

Issues

If you find any issues, feel free to create an issue or send a pull request directly.

Contributing

See CONTRIBUTING.md

License

Apache 2.0

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewConnector creates a connection that can be used with sql.OpenDB().
No description provided by the author
WithAccessToken sets up the Personal Access Token.
WithHTTPPath sets up the endpoint to the warehouse.
Sets the initial catalog name and schema name in the session.
WithMaxRows sets up the max rows fetched per request.
WithPort sets up the server port.
WithServerHostname sets up the server hostname.
Sessions params will be set upon opening the session by calling SET function.
WithTimeout adds timeout for the server query execution.
Used to identify partners.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author