Configuring a client, driver, library, or third-party application to connect to Snowflake¶
To configure a client, driver, library, or application to connect to Snowflake, you must specify your Snowflake account identifier. In addition, you might need to specify the warehouse, database, schema, and role that should be used.
Specifying the account to use¶
Clients, connectors, and drivers use a variety of syntaxes to connect to Snowflake. In general, you should use the variation
that includes the organization name (orgname
) and account name (account_name
), with the following exception: If you use the Client Redirect feature, replace the name of the account (account_name
) with the name of the connection (connection_name
). For examples of this syntax, see Using a connection URL.
To configure a private connection to the Snowflake service, add .privatelink
to either the account name or the account locator syntax. To determine which value you should use to connect to Snowflake when using private connectivity, call the SYSTEM$GET_PRIVATELINK_CONFIG function in your Snowflake account.
If you need to use the account locator, you might also need to specify the cloud region ID, the cloud, and the level of government
compliance as additional segments after the account locator. For the format to use, see Format 2: Account locator in a region. In the
examples below, account_locator_with_additional_segments
represents the account location with any additional segments
that are required.
- SnowSQL:
Account name:
snowsql -a orgname-account_name
Account locator:
snowsql -a account_locator_with_additional_segments
For additional information, see Connection syntax.
- JDBC:
Account name:
jdbc:snowflake://orgname>-<account_name.snowflakecomputing.com/?connection_paramsr
Account locator:
jdbc:snowflake://account_locator_with_additional_segments.snowflakecomputing.com/?connection_params
For additional information, see JDBC Driver connection string.
- ODBC:
Account name:
Server:
orgname-account_name.snowflakecomputing.com
Account locator:
Server:
account_locator_with_additional_segments.snowflakecomputing.com}
For additional information, see ODBC configuration and connection parameters.
- Python:
Account name:
Set the
ACCOUNT
parameter value asorgname-account_name
.
Account locator:
Set the
ACCOUNT
parameter value asaccount_locator_with_additional_segments
.
For additional information, see Connecting to Snowflake with the Python Connector.
- .Net:
Account name:
Set the
ACCOUNT
parameter value asorgname-account_name
.Set the
HOST
parameter value as the default (.snowflakecomputing.com
).
Account locator:
Set the
ACCOUNT
parameter value asaccount_locator_with_additional_segments
.Set the
HOST
parameter value as the default.snowflakecomputing.com
. Specify if your Snowflake account is not in theus-west
region.
For additional information, see Connecting.
- Golang:
Account name:
db, err := sql.Open("snowflake", "jsmith:mypassword@orgname-account_name/mydb/testschema?warehouse=mywh")
Account locator:
sql.Open("snowflake", "jsmith:mypassword@account_locator_with_additional_segments/mydb/testschema?warehouse=mywh")
For additional information, see Connection String.
- node.js:
Account name: Set the
ACCOUNT
parameter value asorgname-account_name
.Account locator: Set the
ACCOUNT
parameter value asaccount_locator_with_additional_segments
.
For additional information, see Managing connections.
- Spark (connector):
Account name: Same as JDBC
Account locator: Same as JDBC
For additional information, see Setting Configuration Options for the Connector.
- Spark (Databricks):
Account name:
Account URL for Snowflake account
Account locator:
Account Locator URL for Snowflake account
For additional information, see Configuring Snowflake for Spark in Databricks.
- Spark (Qubole):
Account name: Set the Host Address field value as
orgname-account_name.snowflakecomputing.com
.Account locator: Set the Host Address field value as
account_locator_with_additional_segments.snowflakecomputing.com
.
For additional information, see Configuring Snowflake for Spark in Qubole.
- PHP:
Account name:
Set the
ACCOUNT
parameter value asorgname-account_name
.Leave the
REGION
parameter value blank for all regions.
Account locator:
Set the
ACCOUNT
parameter value asaccount_locator
.Set the
REGION
parameter value if your Snowflake account is not in theus-west
region.
For additional information, see Connecting to the Snowflake database.
- SQLAchemy:
Account name:
snowflake://user_login_name:password@orgname-account_name
Account locator:
snowflake://user_login_name:password@account_locator_with_additional_segments
For additional information, see Using the Snowflake SQLAlchemy toolkit with the Python Connector.
Using SQL statements to find your account identifier¶
To get the organization_name-account_name
form of your account identifier, execute the following SQL command:
SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME();
To get the account locator form of your account identifier, execute the following SQL command:
SELECT CURRENT_ACCOUNT();
Additional configuration steps¶
The next topics cover specific areas of configuring a connection: