Using Postgree SQL mission persistent connection issues

Screen Link: https://app.dataquest.io/m/114/using-postgresql/8/creating-a-database

Your Code: import psycopg2 as p
conn = p.connect(“dbname = dq username = dq”)
cur = conn.cursor()
conn.autocommit = True
cur.execute (“CREATE DATABASE income OWNER dq”)
conn.close()

What I expected to happen: I expected the code to run!

What actually happened: After pressing the run code buttom, the loading animation does not stop and an exclamation symbol in the connection status merge with the following message:
connection issue found

My internet connection is okay because i’m using other online services perfectly. This error has been occuring for 48 hours. This is really annoying because I usually spend more time learning in your platform during weekends. It is not the first time I lose useful hours of learning due to connection issues in the website… Please find a solution soon.

1 Like

Hi @vinicius.viena1,

import psycopg2 as p
conn = p.connect("dbname = dq username = dq")
cur = conn.cursor()
conn.autocommit = True
cur.execute ("CREATE DATABASE income OWNER dq")
conn.close()

The connection string in your code is not correct. Instead of generating an error message, our platform is throwing a connection issue. Sorry about that!

To fix this issue:

  1. Hard Refresh the page
  2. Change: conn = p.connect("dbname = dq username = dq") to: conn = p.connect("dbname = dq user = dq")

And your code will pass the answer checker without any issue.

import psycopg2 as p
conn = p.connect("dbname = dq user = dq")
cur = conn.cursor()
conn.autocommit = True
cur.execute ("CREATE DATABASE income OWNER dq")
conn.close()

Best,
Sahil

1 Like