Connecting your database

Connecting to Redshift and Postgres

The following fields are required when creating a Redshift connection:

FieldDescriptionExamples
Host NameThe hostname of the Postgres or Redshift database to connect to. This can either be a hostname an IP address.xxx.us-east-1.amazonaws.com
PortUsually 5432 (Postgres) or 5439 (Redshift)5439
DatabaseThe logical database to connect to and run queries against.analytics
Configuring a Redshift connection
Configuring a Redshift connection

Connecting via an SSH Tunnel

To connect to a Postgres or Redshift instance via an SSH tunnel, check the "Use SSH Tunnel" option when creating your connection. When configuring the tunnel, you'll need to supply the hostname, username, and port for the bastion server.

Once the connection is saved, a public key will be generated and displayed for the Connection. You can copy this public key to the bastion server to authorize dbt Cloud to connect to your database via the bastion server.

A generated public key for a Postgres connection
A generated public key for a Postgres connection

Connecting to Snowflake

The following fields are required when creating a Snowflake connection:

FieldDescriptionExamples
AccountThe Snowflake account to connect todb5261993, db5261993.east-us-2.azure
RoleAn optional field indicating what role should be assumed after connecting to Snowflaketransformer
DatabaseThe logical database to connect to and run queries against.analytics
WarehouseThe virtual warehouse to use for running queries.transforming

Snowflake connection details

Username / Password

Available in: Development environments, Deployment environments

The Username / Password auth method is the simplest way to authenticate Development or Deployment credentials in a dbt project. Simply enter your Snowflake username (specifically, the login_name) and the corresponding user's Snowflake password to authenticate dbt Cloud to run queries against Snowflake on behalf of a Snowflake user.

Snowflake username/password auth

Key Pair

Available in: Development environments, Deployment environments

The Keypair auth method uses Snowflake's Key Pair Authentication to authenticate Development or Deployment credentials for a dbt Cloud project.

After generating an encrypted key pair, be sure to set the rsa_public_key for the Snowflake user to authenticate in dbt Cloud:

alter user jsmith set rsa_public_key='MIIBIjANBgkqh...';

Finally, set the "Private Key" and "Private Key Passphrase" fields in the "Edit Credentials" page to finish configuring dbt Cloud to authenticate with Snowflake using a key pair.

Note: At the present time, dbt Cloud must be provided with an encrypted private key along with an encryption password. A future release of dbt Cloud will remove this restriction, and passwordless private keys will be supported.

Snowflake keypair auth

OAuth

Available in: Development environments, Enterprise plans only

The OAuth auth method permits dbt Cloud to run development queries on behalf of a Snowflake user without the configuration of Snowflake password in dbt Cloud. For more information on configuring a Snowflake OAuth connection in dbt Cloud, please see the docs on setting up Snowflake OAuth.

Configuring Snowflake OAuth for a connection

Connecting to BigQuery

Uploading a JSON keyfile should populate the following fields:

  • Project id
  • Private key id
  • Private key
  • Client email
  • Client id
  • Auth uri
  • Token uri
  • Auth provider x509 cert url
  • Client x509 cert url

In addition to these fields, there are two other optional fields that can be configured in a BigQuery connection:

FieldDescriptionExamples
TimeoutDeprecated; exists for backwards compatibility with older versions of dbt and will be removed in the future.300
LocationThe location where dbt should create datasets.US, EU
A valid BigQuery connection
A valid BigQuery connection