Connecting to Snowflake Postgres

Once you create a Snowflake Postgres instance, you can connect to it with any postgresql client, such as psql or DBeaver. To establish a connection you will need to configure your client with:

  • The hostname of the instance. This is the URL of the virtual machine host.

  • A username. When you create an instance the snowflake_admin user is created by default and designed for administrative access.

  • The Postgres database you want to connect to. This parameter is required to create Postgres connections. The default database is named ‘postgres’.

  • A password for your user.

Here is an example of these connections details used with the psql command line client:

$ psql -h abcefg.snowflake.app  -U snowflake_admin -d postgres
Copy

(psql will prompt for a password)

If you need to specify a port, use 5432:

$ psql -h abcefg.snowflake.app  -U snowflake_admin -p 5432 -d postgres
Copy

Important

SSL is required to connect to Snowflake Postgres instances

About connection strings

When creating a Postgres instance via Snowsight, Snowflake Postgres provides a connection string in libpq URI format to use to connect directly via psql or to input into your application configuration.

Note

A cluster’s connection string will remain the same across cluster management operations unless you explicitly reset access for a given role.

The connection string as a database URL contains the following parameters:

  • protocol: postgres://

  • username: See Snowflake Postgres Roles for more details

  • password

  • hostname

  • port: 5432

  • database_name: Defaults to postgres

These are then used to build a URI connection string with this format:

postgresql://<username>:<password>@hostname:<port>/<database_name>
Copy

If your client environment is not otherwise configured to enforce SSL connections you can append ?sslmode=require to the URI:

postgresql://<username>:<password>@hostname:<port>/<database_name>?sslmode=require
Copy