diff --git a/db.py b/db.py index 5adb7fd2..a8be6d1f 100644 --- a/db.py +++ b/db.py @@ -1,5 +1,7 @@ +import asyncio import sys +import aiomysql import mariadb from decouple import config @@ -8,6 +10,23 @@ password = config('DB_PASS') 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 def connection(): try: