Skip to main content

Connect a database

A connection lets DataViz read from your database or warehouse. Connect once, and everyone with the right role can build datasets, charts and queries on it.

Supported databases

DatabaseDefault portWhat you'll need
PostgreSQL5432Host, port, database, username, password. Optional SSL mode and default schema.
MySQL3306Host, port, database, username, password. SSL is on by default.
MariaDB3306Host, port, database, username, password. SSL is on by default.
Microsoft SQL Server1433Host, port, database, username, password.
Snowflake–Account identifier, database, username, and a key pair or a password (or programmatic access token). Optional warehouse, role and schema.
Google BigQuery–Project ID and a service account key (JSON). Optional default dataset, location and a limit on what one query may bill.
Amazon Athena–AWS region, an IAM user's access key ID and secret access key, and an S3 location for query results (or a workgroup that sets one). Optional database.
Amazon Redshift5439Cluster endpoint, port, database, username, password.
ClickHouse8123Host, port, database, username, password. Optional secure (HTTPS) connection.
SQLite–Upload the database file. See Upload a file.

CSV, Excel and JSON files work too: see Upload a file. Your administrator can limit which database types a DataViz installation offers, and can switch on more: hosted PostgreSQL and MySQL services (such as Amazon Aurora, Supabase, Neon and AlloyDB), CockroachDB, Databricks, query engines (Trino, Starburst, Presto, Apache Hive, Spark SQL, Impala, Dremio and Apache Drill) and analytical databases (such as StarRocks, Apache Doris and SingleStore). Each one that's switched on appears in the list with its own form and setup notes.

Before you connect

  1. Create a read-only user

    Give DataViz its own database user that can only read the schemas you want to analyze. Analysis never needs to write to your database, and a read-only user means it can't.

  2. Make the database reachable

    DataViz connects over the internet to the host you enter. If your database sits behind a firewall, allow incoming connections from DataViz on the database's port.

Snowflake, BigQuery and Athena

These connect over HTTPS to the vendor's own service, so there's no host, port or SSL setting. Each one signs in with credentials you create for DataViz, and never with anything else on the DataViz side.

Snowflake

Enter the Account identifier (such as myorg-myaccount; in Snowflake, choose your name at the bottom left, then Account, then View account details). Pasting the account URL works too. Sign in with a Key pair: create a user for DataViz, set its RSA_PUBLIC_KEY, and paste the private key (.p8) and its passphrase, if it has one. A password or a programmatic access token also works, but Snowflake is phasing out password-only sign-in. Give the user a role that can only read: USAGE on the warehouse, database and schemas, and SELECT on the tables.

Google BigQuery

Create a service account, give it BigQuery Data Viewer on the datasets and BigQuery Job User on the project, then create a JSON key for it and paste the whole file. Only service account keys are accepted. Every query is billed by BigQuery, so consider setting Most a query may bill: a query that would scan more is refused before it runs.

Amazon Athena

Create an IAM user for DataViz whose policy allows running Athena queries, reading the Glue Data Catalog and the data in S3, and writing to the query results location. Use its long-term access key (it starts with AKIA); temporary keys expire. Leave the results location empty if the workgroup you enter sets one.

Add a connection

  1. Open Databases

    In the sidebar choose Databases, then Connect Database.

  2. Choose the database type

    Types are grouped into relational databases, cloud warehouses, and files. Type in the search box to filter.

  3. Enter the details

    Give the connection a name your team will recognize, such as Production DB, then fill in the host, port, database, username and password. Tick Enable SSL/TLS if your database requires encrypted connections, which most hosted databases do.

  4. Test and save

    Choose Test connection. DataViz checks the address, signs in and reads the schema, and tells you which step failed if one does. When it passes, choose Save connection.

The new connection appears on the Databases page. Next, create a dataset from one of its tables, or explore it straight away in SQL Lab.

Connection options

The sections below the main fields are optional. The defaults suit most connections.

SQL Lab

Expose database in SQL Lab
Show this connection in SQL Lab's database picker.
Allow DDL and DML
Let SQL Lab run statements that change data or structure. Off by default; leave it off for a read-only analytics connection.
Allow CREATE TABLE AS
Let people save query results as new tables in this database.
Enable query cost estimation
Show the database's estimate of a query's cost before you run it, where the database supports it.
Disable SQL Lab data preview queries
Stop the schema browser from sampling rows, for databases where every query is billed.

Performance

Chart cache timeout
How long, in seconds, chart results from this connection may be reused before the database is asked again. 0 means they never expire; -1 always asks the database.
Schema cache timeout
How long the list of schemas and tables is remembered.
Asynchronous query execution
Run long queries in the background so they don't block the page.

Security

Paste a Root certificate if your database uses a certificate from a private authority, so DataViz can verify the server it's talking to.

Edit, test or remove a connection

Each connection on the Databases page shows its type, when it was created and whether it has been tested. Use its buttons to test it again, duplicate it, edit it or delete it.

How credentials are protected

  • Passwords, keys and tokens are encrypted before they're stored, and are never sent back to the browser.
  • When you edit a connection, leave the password field blank to keep the saved one.
  • Every query runs with the permissions of the person asking, including row and column-level security.