$ sudo apt install postgresql-server-dev-all

$ pip3 install psycopg2

$ python3

import psycopg2 as pg2 
conn=pg2.connect(database="postgres",user="postgres",password="1234",host="localhost",port="5432") 
cur = conn.cursor() 
cur.execute("select * from table_name") 
cur.fetchall()

[링크 : https://freeprog.tistory.com/100]

Posted by 구차니

댓글을 달아 주세요