Connecting a database

Import from PostgreSQL or MySQL, by table or by query.

You can connect a PostgreSQL or MySQL database and import from it, either by picking a table or by writing a SELECT.

Creating a connection

Provide the host, port, database, user and password. Credentials are encrypted before they are stored, and the connection is tested before it is saved so a typo is caught immediately rather than at the first import.

Import by table, or by query

  • By table — browse the schema and pick one. Simplest, and the right choice most of the time.
  • By query — write a single SELECT. Useful for joining, filtering or aggregating before the data ever arrives.

Query mode accepts exactly one SELECT statement. Anything else is refused, which is deliberate: an import is a read, and a connection that can only read is one that cannot be persuaded to write.

Import mode

Imported rows are copied into the same columnar format as an uploaded file. Your database is queried when the import runs, not every time somebody opens a chart — so a dashboard with many visuals does not turn into many queries against your production database.

The trade is that data is as current as the last import, which is what scheduled refresh exists to manage.

If a connection fails

The most common causes, roughly in order:

  • the database is not reachable from the server (firewall or allowlist),
  • the user lacks SELECT on the table,
  • SSL is required and not enabled, or vice versa.

The error shown when a test fails is the database's own message, which is usually specific enough to act on.