web-backend/dao/db/util.py

15 lines
439 B
Python

from conf.util import get_config_object
import pymysql
conf = get_config_object()
host = conf.get('database', 'host')
port = conf.getint('database', 'port')
user = conf.get('database', 'user')
password = conf.get('database', 'password')
database = conf.get('database', 'database')
def get_connet() -> pymysql.Connection:
return pymysql.connect(host=host, port=port, user=user, password=password, database=database, charset='utf8')