|
|
@ -1,5 +1,7 @@
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import aiomysql
|
|
|
|
import mariadb
|
|
|
|
import mariadb
|
|
|
|
from decouple import config
|
|
|
|
from decouple import config
|
|
|
|
|
|
|
|
|
|
|
@ -8,6 +10,23 @@ password = config('DB_PASS')
|
|
|
|
host = config('DB_HOST')
|
|
|
|
host = config('DB_HOST')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Setting up connection using pool/aiomysql
|
|
|
|
|
|
|
|
async def connection2(loop):
|
|
|
|
|
|
|
|
pool = await aiomysql.create_pool(
|
|
|
|
|
|
|
|
host=host,
|
|
|
|
|
|
|
|
port=3306,
|
|
|
|
|
|
|
|
user="hamothy",
|
|
|
|
|
|
|
|
password=password,
|
|
|
|
|
|
|
|
db='enso',
|
|
|
|
|
|
|
|
loop=loop)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return pool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loop = asyncio.get_event_loop()
|
|
|
|
|
|
|
|
loop.run_until_complete(connection2(loop))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Connect to MariaDB Platform and database Enso
|
|
|
|
# Connect to MariaDB Platform and database Enso
|
|
|
|
def connection():
|
|
|
|
def connection():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|