parent
c3f404b9b5
commit
d7208088d4
@ -1,9 +0,0 @@
|
||||
import db.mysql_connection as connection
|
||||
|
||||
conn = connection.get_new_mysql_connection('../db_config.ini')
|
||||
|
||||
print(conn.charset)
|
||||
print('isConnected :: ', conn.is_connected())
|
||||
|
||||
conn.close()
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
import db.mysql_connection as connection
|
||||
import db.constants as const
|
||||
|
||||
conn = connection.get_new_mysql_connection(const.DB_CONFIG_FILE)
|
||||
|
||||
print('MySQL Server version :: ', conn.get_server_info())
|
||||
print('isConnected :: ', conn.is_connected())
|
||||
|
||||
conn.close()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[mysql]
|
||||
host = 127.0.0.1
|
||||
host = MYSQL_HOST
|
||||
port = 3306
|
||||
database = bitext-aligner
|
||||
user = root
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
JSON_PATH = 'json/books.json'
|
||||
|
||||
XSD_PATH = 'xml_files/book.xsd'
|
||||
XSD_PATH = 'xml_files/book.xsd'
|
||||
|
||||
TRANSLATE_ENV_VAR = 'GOOGLE_APPLICATION_CREDENTIALS'
|
||||
|
||||
MYSQL_PASS_ENV_VAR = 'MYSQL_PASSWORD'
|
||||
|
||||
MYSQL_HOST_ENV_VAR = 'MYSQL_HOST'
|
||||
|
||||
WARNING = '\033[91m'
|
||||
END = '\033[0m'
|
||||
|
||||
BLUE = '\033[94m'
|
||||
GREEN = '\033[92m'
|
||||
@ -0,0 +1,15 @@
|
||||
import os
|
||||
import utils.constants as const
|
||||
|
||||
|
||||
def check_env_variables():
|
||||
if const.TRANSLATE_ENV_VAR not in os.environ:
|
||||
print(const.WARNING, 'Please set the ', const.TRANSLATE_ENV_VAR, ' Environment Variable to continue....', const.END)
|
||||
return False
|
||||
if const.MYSQL_PASS_ENV_VAR not in os.environ:
|
||||
print(const.WARNING, 'Please set the ', const.MYSQL_PASS_ENV_VAR, ' Environment Variable to continue....', const.END)
|
||||
return False
|
||||
if const.MYSQL_HOST_ENV_VAR not in os.environ:
|
||||
print(const.WARNING, 'Please set the ', const.MYSQL_HOST_ENV_VAR, ' Environment Variable to continue....', const.END)
|
||||
return False
|
||||
return True
|
||||
Loading…
Reference in new issue