• Stars
    star
    291
  • Rank 141,673 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 21 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go Snowflake Driver

Go Snowflake Driver

This topic provides instructions for installing, running, and modifying the Go Snowflake Driver. The driver supports Go's database/sql package.

Prerequisites

The following software packages are required to use the Go Snowflake Driver.

Go

The latest driver requires the Go language 1.19 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.

Installation

Get Gosnowflake source code, if not installed.

go get -u github.com/snowflakedb/gosnowflake

Docs

For detailed documentation and basic usage examples, please see the documentation at godoc.org.

Sample Programs

Snowflake 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 include $GOPATH/bin in the environment variable $PATH. Run the make command to build all sample programs.

make install

In the following example, the program select1.go is built and installed in $GOPATH/bin and can be run from the command line:

SNOWFLAKE_TEST_ACCOUNT=<your_account> \
SNOWFLAKE_TEST_USER=<your_user> \
SNOWFLAKE_TEST_PASSWORD=<your_password> \
select1
Congrats! You have successfully run SELECT 1 with Snowflake DB!

Development

The developer notes are hosted with the source code on GitHub.

Testing Code

Set the Snowflake connection info in parameters.json:

{
    "testconnection": {
        "SNOWFLAKE_TEST_USER":      "<your_user>",
        "SNOWFLAKE_TEST_PASSWORD":  "<your_password>",
        "SNOWFLAKE_TEST_ACCOUNT":   "<your_account>",
        "SNOWFLAKE_TEST_WAREHOUSE": "<your_warehouse>",
        "SNOWFLAKE_TEST_DATABASE":  "<your_database>",
        "SNOWFLAKE_TEST_SCHEMA":    "<your_schema>",
        "SNOWFLAKE_TEST_ROLE":      "<your_role>"
    }
}

Install jq so that the parameters can get parsed correctly, and run make test in your Go development environment:

make test

Capturing Code Coverage

Configure your testing environment as described above and run make cov. The coverage percentage will be printed on the console when the testing completes.

make cov

For more detailed analysis, results are printed to coverage.txt in the project directory.

To read the coverage report, run:

go tool cover -html=coverage.txt

Submitting Pull Requests

You 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.

Support

For official support, contact Snowflake support at: https://support.snowflake.net/.

More Repositories

1

snowflake-connector-python

Snowflake Connector for Python
Python
574
star
2

snowpark-python

Snowflake Snowpark Python API
Python
253
star
3

snowflake-sqlalchemy

Snowflake SQLAlchemy
Python
231
star
4

spark-snowflake

Snowflake Data Source for Apache Spark.
Scala
211
star
5

SnowAlert

Security Analytics Using The Snowflake Data Warehouse
Python
181
star
6

snowflake-connector-net

Snowflake Connector for .NET
C#
175
star
7

snowflake-jdbc

Snowflake JDBC Driver
Java
172
star
8

snowflake-cli

Snowflake CLI is an open-source command-line tool explicitly designed for developer-centric workloads in addition to SQL operations.
Python
168
star
9

snowflake-kafka-connector

Snowflake Kafka Connector (Sink Connector)
Java
135
star
10

snowflake-connector-nodejs

NodeJS driver
JavaScript
119
star
11

polaris-catalog

Polaris Catalog is an open source catalog for Apache Iceberg
90
star
12

snowflake-ingest-java

Java SDK for the Snowflake Ingest Service -
Java
66
star
13

dplyr-snowflakedb

SnowflakeDB backend for dplyr
R
65
star
14

pdo_snowflake

PHP PDO driver for snowflake
C
58
star
15

snowflake-ingest-python

A Python API for Asynchronously Loading Data into Snowflake DB -
Python
56
star
16

snowflake-ml-python

Python
38
star
17

libsnowflakeclient

Snowflake Connector for C/C++
C
25
star
18

connectors-native-sdk

Snowflake Native SDK for Connectors
Java
25
star
19

native-apps-examples

Public-facing example applications built using the Snowflake Native App Framework
Python
22
star
20

snowpark-java-scala

Snowflake Snowpark Java & Scala API
Scala
18
star
21

snowflake-hive-metastore-connector

Java
13
star
22

snowflake-s3compat-api-test-suite

S3Compat API Test Suite
Java
12
star
23

snowflake-telemetry-python

Python
7
star
24

snowflake-rest-api-specs

Public rest api specs for Snowflake
4
star
25

snowflake-common

3
star
26

native-apps-templates

Official Snowflake CLI templates released for the Snowflake Native App Framework
Python
3
star
27

homebrew-snowflake-cli

Ruby
1
star
28

reusable-workflows

A reusable workflow that will be used by repositories to run semgrep on each PR
1
star
29

snowflake-hibernate

Snowflake SQL dialect definition for Hibernate ORM
Java
1
star