Maj module
This commit is contained in:
parent
9acf0f5a7e
commit
918de9e524
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1 @@
|
|||
conf.ini
|
||||
config/conf.ini
|
||||
|
|
|
@ -21,5 +21,5 @@ __license__ = 'Beerware'
|
|||
try:
|
||||
import pymysql
|
||||
except ImportError:
|
||||
print('PyMSQL library not found')
|
||||
print('PyMYSQL library not found')
|
||||
sys.exit(1)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,5 +0,0 @@
|
|||
[sql]
|
||||
host=localhost
|
||||
database=adherents_services
|
||||
user=root
|
||||
passwd=Boris1989!
|
|
@ -15,7 +15,7 @@ from configparser import SafeConfigParser
|
|||
import pymysql
|
||||
|
||||
# Read conf.ini
|
||||
INI_CONF = "./conf.ini"
|
||||
INI_CONF = "./config/conf.ini"
|
||||
CONFIG = SafeConfigParser()
|
||||
CONFIG.read(INI_CONF)
|
||||
|
||||
|
@ -30,7 +30,7 @@ class HandleSql:
|
|||
"""Class to handle sql connection."""
|
||||
|
||||
@staticmethod
|
||||
def sql_check():
|
||||
def sql_checkcon():
|
||||
"""Init sql connection."""
|
||||
try:
|
||||
global conn
|
||||
|
|
10
test.py
10
test.py
|
@ -3,7 +3,11 @@
|
|||
|
||||
from manage_sql.manage_sql import HandleSql
|
||||
|
||||
MY_PSQL_CONN = HandleSql()
|
||||
MY_SQL_CONN = HandleSql()
|
||||
|
||||
check_return_bdd = MY_PSQL_CONN.psql_checkcon()
|
||||
print(check_return_bdd)
|
||||
try:
|
||||
check_return_bdd = MY_SQL_CONN.sql_checkcon()
|
||||
except OperationalError as error:
|
||||
print(error)
|
||||
else:
|
||||
print(check_return_bdd)
|
||||
|
|
Loading…
Reference in a new issue