From 3b38eae5e3484eac92805c82eb80d2ba68f08b6d Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Sun, 22 Nov 2020 10:03:56 +0100 Subject: [PATCH] manage_sql.py: sql_checkcon() was the same funcion as conn() --- manage_sql.py | 10 ---------- test.py | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/manage_sql.py b/manage_sql.py index 13ddc9d..79912c5 100755 --- a/manage_sql.py +++ b/manage_sql.py @@ -36,16 +36,6 @@ SQL_PWD = CONFIG.get('sql', 'passwd') class HandleSql: """Class to handle sql connection.""" - @staticmethod - def sql_checkconn(): - """Check MySQL connection.""" - try: - global conn - conn = pymysql.connect(host=SQL_HOST, db=SQL_DB, user=SQL_USER, passwd=SQL_PWD) - cur = conn.cursor() - except pymysql.DatabaseError as error: - print(error) - @staticmethod def sql_conn(): """Init sql connection.""" diff --git a/test.py b/test.py index ceee86a..67cb8fa 100644 --- a/test.py +++ b/test.py @@ -3,10 +3,10 @@ from manage_sql.manage_sql import HandleSql -MY_SQL_CONN = HandleSql() +MYSQL_CONN = HandleSql() try: - check_return_bdd = MY_SQL_CONN.sql_checkcon() + check_return_bdd = MYSQL_CONN.conn() except OperationalError as error: print(error) else: