lib: database: Initial database support

This commit implements basic support for PostgreSQL databases. It can:
- Connect to a database
- Summon a cursor
Further functionality will be worked on soon
This commit is contained in:
Lux Aliaga 2022-03-09 02:27:30 -03:00
parent b2fac1129e
commit b2297efcdb
1 changed files with 18 additions and 0 deletions

18
lib/database.py Normal file
View File

@ -0,0 +1,18 @@
import psycopg2
class Database:
def __init__(self, db, user, password, host, port, init):
if host == 0:
host = "localhost"
if port == 0:
port = 5432
__conn = psycopg.connect(dbname=db, user=user, password=password, host=host, port=port)
cur = __conn.cursor
def write():
pass
def read():
pass