Chartio
  • Product
  • Uses
  • Support
  • Company
  • Sign In
  • Contact Us
  • Support Forums
  • Submit a Ticket
  • Education
  • FAQ
  • Documentation

Connecting to a PostgreSQL Database

In Short: execute the following commands on the database server and go through the connection wizard.

sudo pip install chartio
chartio_setup

There are two ways to connect a PostgreSQL database to Chartio.

  1. Connection Client setup (recomended) - easiest and most secure setup
  2. Direct Connection - for Amazon RDS, Heroku, and any other database hosting services that don't allow shell access.

Connection Client setup

Chartio has built a light weight set of scripts to make the highest connection security practices a breeze to setup. You can read more details about the connection client here.

For most Linux systems the following commands should get the Chartio client installed and start the connection wizard.

sudo pip install chartio
chartio_setup

The chartio_setup wizard will walk you through setting up a readonly user, connecting to Chartio, and then give you a link to visit your dashboard and see some charts being automatically generated.

Don't have pip but have easy_install?

If you don't have pip, but have easy_install you can alternatively run the following

sudo easy_install chartio
chartio_setup

Don't have pip or easy_install clients?

If you do not have the pip or easy_install python package managers you can either install pip with the following commands

$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ python get-pip.py

or download and install the Chartio Connection Client source yourself:

curl https://chartio.com/static/src/chartio-latest.tar.gz -o chartio-latest.tar.gz
tar xvzf chartio-latest.tar.gz
cd chartio-latest
sudo python setup.py install
chartio_setup

Direct Connection

If you're PostgreSQL database is hosted on Amazon RDS, Heroku or another hosting service that does not allow shell access to the database instances, you won't be able to use the Connection Client and will instead need to connect directly. If you're database is on Amazon RDS please visit the RDS setup documentation to first enable chartio to your security group before following these steps.

In your project settings select + New Data Source in the Data Sources column. You'll be brought to the following list of connection options where you can choose PostgreSQL to connect your PostgreSQL database.

Choose Datasource

You will be brought to a page where you can choose between connecting with the Connection Client or the Direct Connection. Since you're reading this documentation you likely want to use the Direct Connection so select it.

select direct connect option

Now you'll see the following form for putting in your connection information.

PostgreSQL connection form

To connect to PostgreSQL Chartio needs the following information.

  1. host - the host name or IP address of the server your database is hosted on
  2. database name - the name of the database you're connecting
  3. user - the name of a preferably read-only user to your database
  4. password - the password for the read-only user
  5. port - the port that the database is listening to (default: 5432)

Creating a Read-only User

Creating a Read-only User with the pgAdmin GUI interface

Creating a Read-only user from the command line with PSQL

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.

To allow the user 'chartio_read_only' to connect to the database 'mydatabase' from Chartio's IP address (173.203.96.249) you would add the following line to pg_hba.conf:

host mydatabase chartio_read_only 173.203.96.249/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.

Debugging

If you have issues connecting with Chartio, the exact PostgreSQL or connection errors should be displayed for you as form errors when submitting. If you are unclear on what the error messages mean or how to fix them do not hesitate to email us at support@chartio.com.

If you have already established a database connection but something is going wrong, please read our documentation on database connection debugging.

Navigation

datasources

    • connections
    • Google Analytics
    • MySQL
    • Heroku
    • Rackspace Cloud Databases
    • PostgreSQL
    • Oracle
    • Salesforce
    • Amazon RDS
  • Connection Client Requirements
  • Moving a Database Server
  • Debug
  • Connection Client Explained
  • Data Schema Editor
  • Measures and Dimensions

collaboration

  • Scheduling Reports
  • Adding Teammates
  • Access Permissions
  • Change Permissions

projects

  • Projects
  • Changing Projects

dashboards

  • Create a Dashboard
  • Arranging
  • Resizing
  • Email Reports
  • Refreshing
  • Global Filters
  • Exporting PDF

charts

    • chart types
    • Scatter Plot
    • Percent Area
    • Line Chart
    • Bar
    • Tables
    • Percent Bar
    • Grouped Bar
    • Area
    • Pie
    • Single Value
    • creating
    • Layers
    • Multi-dimensional Data
    • Raw Data
    • Creating Charts
    • SQL Mode
    • using filters
    • Measures
    • Dimensions
    • Time and Date
  • Exporting
  • Cloning
  • Moving

account

  • Changing Password
  • Canceling your Account
  • Changing Payment Method
  • Changing Username
  • Upgrading your Account

best practices

  • MySQL Backups

further support

  • Support Forum
  • Frequently Asked Questions
  • Buzzwords Debunked
  • support@chartio.com
  • Product
  • Tour
  • Data Sources
  • Security
  • Plans
  • Customers
  • Why Chartio
  • Uses
  • Business Intelligence
  • SQL Charts
  • Excel Charts
  • Google Analytics
  • Operations
  • Support
  • Documentation
  • FAQ
  • Education
  • Submit a Ticket
  • Support Forums
  • Contact Us
  • Company
  • About Us
  • Blog
  • Jobs
  • Press
  • Events
  • Legal
  • @chartio
"We love Chartio. It helps us understand our business and make smarter product decisions. It's so easy that our product and marketing teams pull their own data (which saves our engineers lots of time). Looking back, I can't believe how long it took us to start using it."

Brett Huneycutt, Director of Product, Ancestry.com

Want to find out how we can help you? Email us at hello@chartio.com or call us at +1 (866) 457-7206.

Chartio is built by real people in San Francisco, California.