{"id":18400658,"url":"https://github.com/databricks/databricks-sql-go","last_synced_at":"2025-05-16T05:04:45.088Z","repository":{"id":37055893,"uuid":"493764928","full_name":"databricks/databricks-sql-go","owner":"databricks","description":"Golang database/sql driver for Databricks SQL.","archived":false,"fork":false,"pushed_at":"2025-05-09T17:01:31.000Z","size":2659,"stargazers_count":41,"open_issues_count":35,"forks_count":40,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-15T23:55:42.629Z","etag":null,"topics":["databricks","dwh","golang","golang-library","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/databricks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-05-18T17:36:43.000Z","updated_at":"2025-05-13T06:22:15.000Z","dependencies_parsed_at":"2023-11-17T22:59:41.228Z","dependency_job_id":"2bfdee66-7e2a-4a25-8c7d-d95c6a069829","html_url":"https://github.com/databricks/databricks-sql-go","commit_stats":{"total_commits":203,"total_committers":25,"mean_commits":8.12,"dds":0.7389162561576355,"last_synced_commit":"db03838cfd38dd2ed8375626451875514da23b15"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/databricks","download_url":"https://codeload.github.com/databricks/databricks-sql-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471060,"owners_count":22076585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["databricks","dwh","golang","golang-library","sql"],"created_at":"2024-11-06T02:35:43.093Z","updated_at":"2025-05-16T05:04:45.080Z","avatar_url":"https://github.com/databricks.png","language":"Go","readme":"# Databricks SQL Driver for Go\n\n\n![http://www.apache.org/licenses/LICENSE-2.0.txt](http://img.shields.io/:license-Apache%202-brightgreen.svg)\n\n## Description\n\nThis repo contains a Databricks SQL Driver for Go's [database/sql](https://golang.org/pkg/database/sql) package. It can be used to connect and query Databricks clusters and SQL Warehouses.\n\n## Documentation\n\nSee `doc.go` for full documentation or the Databrick's documentation for [SQL Driver for Go](https://docs.databricks.com/dev-tools/go-sql-driver.html).\n\n## Usage\n\n```go\nimport (\n  \"context\"\n  \"database/sql\"\n  _ \"github.com/databricks/databricks-sql-go\"\n)\n\ndb, err := sql.Open(\"databricks\", \"token:********@********.databricks.com:443/sql/1.0/endpoints/********\")\nif err != nil {\n  panic(err)\n}\ndefer db.Close()\n\n\nrows, err := db.QueryContext(context.Background(), \"SELECT 1\")\ndefer rows.Close()\n```\n\nAdditional usage examples are available [here](https://github.com/databricks/databricks-sql-go/tree/main/examples).\n\n### Connecting with DSN (Data Source Name)\n\nThe DSN format is:\n\n```\ntoken:[your token]@[Workspace hostname]:[Port number][Endpoint HTTP Path]?param=value\n```\n\nYou 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:\n\n```\ntoken:[your token]@[Workspace hostname]:[Port number][Endpoint HTTP Path]?timeout=1000\u0026maxRows=1000\n```\nYou can turn on Cloud Fetch (now enabled by default) to increase the performance of extracting large query results by fetching data in parallel via cloud storage (more info [here](https://www.databricks.com/blog/2021/08/11/how-we-achieved-high-bandwidth-connectivity-with-bi-tools.html)). You can also set the number of concurrently fetching goroutines by setting the `maxDownloadThreads` query parameter (default is 10):\n\n```\ntoken:[your token]@[Workspace hostname]:[Port number][Endpoint HTTP Path]?useCloudFetch=true\u0026maxDownloadThreads=3\n```\nTo disable Cloud Fetch (e.g., when handling smaller datasets or to avoid additional overhead), append `useCloudFetch=false`:\n```\ntoken:[your token]@[Workspace hostname]:[Port number][Endpoint HTTP Path]?useCloudFetch=false\n```\n\n### Connecting with a new Connector\n\nYou can also connect with a new connector object. For example:\n\n```go\nimport (\n\"database/sql\"\n  _ \"github.com/databricks/databricks-sql-go\"\n)\n\nconnector, err := dbsql.NewConnector(\n  dbsql.WithServerHostname(\u003cWorkspace hostname\u003e),\n  dbsql.WithPort(\u003cPort number\u003e),\n  dbsql.WithHTTPPath(\u003cEndpoint HTTP Path\u003e),\n  dbsql.WithAccessToken(\u003cyour token\u003e)\n)\nif err != nil {\n  log.Fatal(err)\n}\ndb := sql.OpenDB(connector)\ndefer db.Close()\n```\n\nView `doc.go` or `connector.go` to understand all the functional options available when creating a new connector object.\n\n## Develop\n\n### Lint\nWe use `golangci-lint` as the lint tool. If you use vs code, just add the following settings:\n``` json\n{\n    \"go.lintTool\": \"golangci-lint\",\n    \"go.lintFlags\": [\n        \"--fast\"\n    ]\n}\n```\n### Unit Tests\n\n```bash\ngo test\n```\n\n## Issues\n\nIf you find any issues, feel free to create an issue or send a pull request directly.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n## License\n\n[Apache 2.0](https://github.com/databricks/databricks-sql-go/blob/main/LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabricks%2Fdatabricks-sql-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatabricks%2Fdatabricks-sql-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabricks%2Fdatabricks-sql-go/lists"}