psycopg2
Psycopg is the most popular PostgreSQL database adapter for the Python programming language.
Install debian globally
1 sudo apt install python3-psycopg2
Select example
1 import psycopg2
2 conn = psycopg2.connect("dbname=dbx user=userx password=1234 host=localhost")
3 cur = conn.cursor()
4 cur.execute("SELECT * FROM myschemax.tablex;")
5 x=cur.fetchall()
6 for item in x:
7 print(item)
8 cur.close()
Python/psycopg2 (last edited 2025-02-07 14:08:11 by vitor)