Check out our step-by-step video showing how to connect your PostgreSQL database to Chartio:

If your PostgreSQL database is hosted on Heroku or Amazon RDS, please follow those instructions for connecting your instance.

PostgreSQL read-only user

The Chartio connection form requires a read-only username and password, which you’ll need to create on your PostgreSQL database before you submit the connection form.

Allowing Chartio to connect to your database

By default, PostgreSQL restricts connections to hosts and networks included in the pg_hba.conf file. You may need to add Chartio’s IP address to this file to allow connectivity to your database; you’d add the line to pg_hba.config in the following format:

host databaseName username 52.6.1.1/32 md5

Here’s an example, where the username is “chartio_read_only” and the database is “mydatabase”:

host mydatabase chartio_read_only 52.6.1.1/32 md5

You may need to restart your PostgreSQL server for the changes to take effect.

For more details on modifying the pg_hba.conf file consult the PostgreSQL documentation.

Query comment

To provide more context to where queries to your data source are coming from, Chartio includes a query comment to any queries we send; it looks similar to the following:

{
	"reason":"chart_editor",
	"user_email":"support@chartio.com",
	"datasource_id":123456,
	"dashboard_slug":"my-dashboard",
	"chart_id":1234567,
	"datasource_alias":"my data source",
	"organization_id":12345,
	"dataset_id":1231231,
	"is_manual":false,
	"dataset_name":"Dataset 1",
	"dashboard_id":456456
}