Accessing cockroachcloud db from python app running in Heroku


Does any know if a python app running in Heroku can access cockroachcloud DB using the psycopg2?

I just updated my Heroku app to point to the cockroachcloud DB, but it is unable to connect. The same app runs fine on a non-Heroku service.


I think we can get this figured out. Can you post the code that you’re using to connect (with sensitive details redacted, of course)? Also, are you trying to connect to a free-tier cluster or a dedicated cluster?

Hi @kernfeld-cockroach .

I am using the following syntax:

as described here:

And I am using the free-tier cluster.


All right, I think I have it. I was just now able to connect to a free-tier cluster from psycopg2. The trick is that you have to URL-encode the equals sign as %3D. I notice you don’t have the cluster option in your connection string, so you’ll need to add the one that you get from the “connect” dialog box on the Cockroach Cloud website. Sorry that this experience is so bumpy, we’re prioritizing making it better!