文章目录
glance
import psycopg2
class Psql:
def __init__(self, dbname, user, password, host='localhost', port=5432):
dsn = f"dbname={dbname} user={user} password={password} host={host} port={port}"
self.conn = psycopg2.connect(dsn)
self.cursor = self.conn.cursor()
def __del__(self):
self.cursor.close()
self.conn.close()
def select