{"id":22281516,"url":"https://github.com/snowflakedb/gosnowflake","last_synced_at":"2025-05-13T21:04:42.008Z","repository":{"id":38008099,"uuid":"69611909","full_name":"snowflakedb/gosnowflake","owner":"snowflakedb","description":"Go Snowflake Driver","archived":false,"fork":false,"pushed_at":"2025-05-05T15:18:02.000Z","size":20452,"stargazers_count":325,"open_issues_count":28,"forks_count":136,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-05-05T15:58:21.106Z","etag":null,"topics":["golang","snowflake"],"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/snowflakedb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-29T22:09:11.000Z","updated_at":"2025-05-05T14:50:59.000Z","dependencies_parsed_at":"2023-12-21T13:25:56.409Z","dependency_job_id":"e35c9d85-dc2a-43ca-b621-99f2b6232781","html_url":"https://github.com/snowflakedb/gosnowflake","commit_stats":null,"previous_names":[],"tags_count":90,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowflakedb%2Fgosnowflake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowflakedb%2Fgosnowflake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowflakedb%2Fgosnowflake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snowflakedb%2Fgosnowflake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snowflakedb","download_url":"https://codeload.github.com/snowflakedb/gosnowflake/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254028479,"owners_count":22002268,"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":["golang","snowflake"],"created_at":"2024-12-03T16:18:51.850Z","updated_at":"2025-05-13T21:04:36.995Z","avatar_url":"https://github.com/snowflakedb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Support\n\nFor official support and urgent, production-impacting issues, please [contact Snowflake Support](https://community.snowflake.com/s/article/How-To-Submit-a-Support-Case-in-Snowflake-Lodge).\n\n# Go Snowflake Driver\n\n\u003ca href=\"https://codecov.io/github/snowflakedb/gosnowflake?branch=master\"\u003e\n    \u003cimg alt=\"Coverage\" src=\"https://codecov.io/github/snowflakedb/gosnowflake/coverage.svg?branch=master\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/snowflakedb/gosnowflake/actions?query=workflow%3A%22Build+and+Test%22\"\u003e\n    \u003cimg src=\"https://github.com/snowflakedb/gosnowflake/workflows/Build%20and%20Test/badge.svg?branch=master\"\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.apache.org/licenses/LICENSE-2.0.txt\"\u003e\n    \u003cimg src=\"http://img.shields.io/:license-Apache%202-brightgreen.svg\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/snowflakedb/gosnowflake\"\u003e\n    \u003cimg src=\"https://goreportcard.com/badge/github.com/snowflakedb/gosnowflake\"\u003e\n\u003c/a\u003e\n\nThis topic provides instructions for installing, running, and modifying the Go Snowflake Driver. The driver supports Go's [database/sql](https://golang.org/pkg/database/sql/) package.\n\n# Prerequisites\n\nThe following software packages are required to use the Go Snowflake Driver.\n\n## Go\n\nThe latest driver requires the [Go language](https://golang.org/) 1.22 or higher. The supported operating systems are Linux, Mac OS, and Windows, but you may run the driver on other platforms if the Go language works correctly on those platforms.\n\n\n# Installation\n\nIf you don't have a project initialized, set it up.\n\n```sh\ngo mod init example.com/snowflake\n```\n\nGet Gosnowflake source code, if not installed.\n\n```sh\ngo get -u github.com/snowflakedb/gosnowflake\n```\n\n# Docs\n\nFor detailed documentation and basic usage examples, please see the documentation at\n[godoc.org](https://godoc.org/github.com/snowflakedb/gosnowflake/).\n\n## Note\n\nThis driver currently does not support GCP regional endpoints. Please ensure that any workloads using through this driver do not require support for regional endpoints on GCP. If you have questions about this, please contact Snowflake Support.\n\n# Sample Programs\n\nSnowflake provides a set of sample programs to test with. Set the environment variable ``$GOPATH`` to the top directory of your workspace, e.g., ``~/go`` and make certain to\ninclude ``$GOPATH/bin`` in the environment variable ``$PATH``. Run the ``make`` command to build all sample programs.\n\n```sh\nmake install\n```\n\nIn the following example, the program ``select1.go`` is built and installed in ``$GOPATH/bin`` and can be run from the command line:\n\n```sh\nSNOWFLAKE_TEST_ACCOUNT=\u003cyour_account\u003e \\\nSNOWFLAKE_TEST_USER=\u003cyour_user\u003e \\\nSNOWFLAKE_TEST_PASSWORD=\u003cyour_password\u003e \\\nselect1\nCongrats! You have successfully run SELECT 1 with Snowflake DB!\n```\n\n# Development\n\nThe developer notes are hosted with the source code on [GitHub](https://github.com/snowflakedb/gosnowflake).\n\n## Testing Code\n\n\nSet the Snowflake connection info in ``parameters.json``:\n\n```json\n{\n    \"testconnection\": {\n        \"SNOWFLAKE_TEST_USER\":      \"\u003cyour_user\u003e\",\n        \"SNOWFLAKE_TEST_PASSWORD\":  \"\u003cyour_password\u003e\",\n        \"SNOWFLAKE_TEST_ACCOUNT\":   \"\u003cyour_account\u003e\",\n        \"SNOWFLAKE_TEST_WAREHOUSE\": \"\u003cyour_warehouse\u003e\",\n        \"SNOWFLAKE_TEST_DATABASE\":  \"\u003cyour_database\u003e\",\n        \"SNOWFLAKE_TEST_SCHEMA\":    \"\u003cyour_schema\u003e\",\n        \"SNOWFLAKE_TEST_ROLE\":      \"\u003cyour_role\u003e\",\n        \"SNOWFLAKE_TEST_DEBUG\":     \"false\"\n    }\n}\n```\n\nInstall [jq](https://stedolan.github.io/jq) so that the parameters can get parsed correctly, and run ``make test`` in your Go development environment:\n\n```sh\nmake test\n```\n\n### Setting debug mode during tests\nThis is for debugging Large SQL statements (greater than 300 characters). If you want to enable debug mode, set `SNOWFLAKE_TEST_DEBUG` to `true` in `parameters.json`, or export it in your shell instance.\n\n## customizing Logging Tags\n\nIf you would like to ensure that certain tags are always present in the logs, `RegisterClientLogContextHook` can be used in your init function. See example below.\n```go\nimport \"github.com/snowflakedb/gosnowflake\"\n\nfunc init() {\n    // each time the logger is used, the logs will contain a REQUEST_ID field with requestID the value extracted \n    // from the context\n\tgosnowflake.RegisterClientLogContextHook(\"REQUEST_ID\", func(ctx context.Context) interface{} {\n\t\treturn requestIdFromContext(ctx)\n\t})\n}\n```\n\n## Setting Log Level\nIf you want to change the log level, `SetLogLevel` can be used in your init function like this:\n```go\nimport \"github.com/snowflakedb/gosnowflake\"\n\nfunc init() {\n    // The following line changes the log level to debug\n\t_ = gosnowflake.GetLogger().SetLogLevel(\"debug\")\n}\n```\nThe following is a list of options you can pass in to set the level from least to most verbose: \n- `\"OFF\"`\n- `\"error\"`\n- `\"warn\"`\n- `\"print\"`\n- `\"trace\"`\n- `\"debug\"`\n- `\"info\"`\n\n\n## Capturing Code Coverage\n\nConfigure your testing environment as described above and run ``make cov``. The coverage percentage will be printed on the console when the testing completes.\n\n```sh\nmake cov\n```\n\nFor more detailed analysis, results are printed to ``coverage.txt`` in the project directory.\n\nTo read the coverage report, run:\n\n```sh\ngo tool cover -html=coverage.txt\n```\n\n## Submitting Pull Requests\n\nYou may use your preferred editor to edit the driver code. Make certain to run ``make fmt lint`` before submitting any pull request to Snowflake. This command formats your source code according to the standard Go style and detects any coding style issues.\n\n## Runaway `dbus-daemon` processes on certain OS\nThis only affects certain Linux distributions, one of them is confirmed to be RHEL. Due to a bug in one of the dependencies (`keyring`),\non the affected OS, each invocation of a program depending on gosnowflake (or any other program depending on the same `keyring`),\nwill generate a new instance of `dbus-daemon` fork which can, due to not being cleaned up, eventually fill the fd limits.\n\nUntil we replace the offending dependency with one which doesn't have the bug, a workaround needs to be applied, which can be:\n* cleaning up the runaway processes periodically\n* setting envvar `DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus` (if that socket exists, or create it) or even `DBUS_SESSION_BUS_ADDRESS=/dev/null`\n\nDetails in [issue 773](https://github.com/snowflakedb/gosnowflake/issues/773)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowflakedb%2Fgosnowflake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowflakedb%2Fgosnowflake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowflakedb%2Fgosnowflake/lists"}