Hello everyone, that's my first time on this forum, but maybe not the last:
I have a problem, i want to create a table in a postgreSQL DB that i created. When i launch my program to create this table, i recieve a psycopg2.Operationalerror with no information about this error. Maybe someone can help me ?
Thank you very much.
I have a problem, i want to create a table in a postgreSQL DB that i created. When i launch my program to create this table, i recieve a psycopg2.Operationalerror with no information about this error. Maybe someone can help me ?
Thank you very much.
import psycopg2 def create_table(): conn=psycopg2.connect("dbname='DB1' user='postgres' password='shakD6yc' host='localhost' port='5432'") cur=conn.cursor() cur.execute("CREATE TABLE IF NOT EXISTS store (item TEXT, quantity INTEGER, price REAL)") conn.commit() conn.close() create_table() And this is what appears in my console when i launch:Error:Traceback (most recent call last): File "C:\Users\Yonathan\source\repos\PostgreSQL - Python\PostgreSQL - Python\PostgreSQL___Python.py", line 60, in <module> create_table() File "C:\Users\Yonathan\source\repos\PostgreSQL - Python\PostgreSQL - Python\PostgreSQL___Python.py", line 8, in create_table conn=psycopg2.connect("dbname='DB1' user='postgres' password='shakD6yc' host='localhost' port='5432'") File "C:\Users\Yonathan\Anaconda3\lib\site-packages\psycopg2\__init__.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError 