Files
bookshelf/back/database.py
Julien Aldon 4639c6d900
Some checks failed
Deploy Bookshelf / deploy (push) Failing after 0s
add tests and automated tests
2026-01-29 10:45:41 +01:00

22 lines
469 B
Python

from .secret import host, user, password, database
import pymysql.cursors
def get_db():
connection = pymysql.connect(
host=host,
user=user,
password=password,
database=database,
charset='utf8mb4',
cursorclass=pymysql.cursors.DictCursor
)
try:
yield connection
finally:
connection.close()
# cursor = connection.cursor()
# cursor.execute(sql, ())
# cursor.fetchall()
# connection.commit()