postgresqlherokulooker-studio

Heroku Postgresql with Google Datastudio


I'm having troubles to connect an existing heroku database to Google Datastudio. I'm trying to add the connection and I get the following:

Access denied, please check your username and password.

Now, I'm 100% sure that I'm correct on those credentials and the problem comes from somewhere else.

I've tried with different setup, either a free or a paid PSQL instance, nothing works.

I've also setup a dummy account on elephantsql and the connection worked the first time without any issue.

Do you have any idea of the cause of that problem?

Edit:

Just found https://www.en.advertisercommunity.com/t5/Data-Studio/Heroku-Postgres-lt-gt-Google-Data-Studio/m-p/1031729 which is not helpful at the time of writing this post.


Solution

  • Since the February 6, 2018 update, Google DataStudio allows SSL connections with PostgreSQL, which is necessary to connect to a database created via Heroku.

    To enable SSL you need to provide client key+cert and server cert, which can be accomplished by taking the following steps:

    1. Generate a self-signed cert + key with openssl for client key + certificate:
    openssl req \
           -newkey rsa:2048 -nodes -keyout client.key \
           -x509 -days 365 -out client.crt
    
    1. Use the postgres_get_server_cert.py script to get the self-signed server cert from heroku psql:

    https://raw.githubusercontent.com/thusoy/postgres-mitm/master/postgres_get_server_cert.py