|
|
@ -3,16 +3,18 @@ import sys
|
|
|
|
import mariadb
|
|
|
|
import mariadb
|
|
|
|
from decouple import config
|
|
|
|
from decouple import config
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get password/host from .env
|
|
|
|
password = config('DB_PASS')
|
|
|
|
password = config('DB_PASS')
|
|
|
|
|
|
|
|
host = config('DB_HOST')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Connect to MariaDB Platform
|
|
|
|
def connection():
|
|
|
|
def connection():
|
|
|
|
# Connect to MariaDB Platform
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
conn = mariadb.connect(
|
|
|
|
conn = mariadb.connect(
|
|
|
|
user="hamothy",
|
|
|
|
user="hamothy",
|
|
|
|
password=password,
|
|
|
|
password=password,
|
|
|
|
host="173.208.202.20",
|
|
|
|
host=host,
|
|
|
|
port=3306,
|
|
|
|
port=3306,
|
|
|
|
database="enso"
|
|
|
|
database="enso"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -20,4 +22,5 @@ def connection():
|
|
|
|
print(f"Error connecting to MariaDB Platform: {e}")
|
|
|
|
print(f"Error connecting to MariaDB Platform: {e}")
|
|
|
|
sys.exit(1)
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Returning connection string
|
|
|
|
return conn
|
|
|
|
return conn
|
|
|
|