adampy / adambot

General-purpose discord bot, called Adam-Bot. The main bot instance is hosted on AWS EC2 Spot Instances, however can run locally when needed.
6 stars 6 forks source link

Use asyncpg over psycopg2 #1

Closed TimMcGilly closed 4 years ago

TimMcGilly commented 5 years ago

I would recommend updating the bot to use asyncpg over psycogpg2 because discord.py is a asynchronous software so using a non-asynchronous db library with it could cause significant issues. Asyncpg is also extremely fast and according to them it is faster than psycogpg2. Asyncpg is also the recommended library by the discord.py devs for db actions. https://github.com/MagicStack/asyncpg I've used it in my own bots and it is fairly simple to set up. I have a few basic examples using it in https://github.com/TotallyCoded/Simple-Example-Discord.py-Bot and I expect migrating to it wouldn't be very difficult.

adampy commented 4 years ago

Hey, sorry for the year long delay! I am soon going to start changing over from psycopg2 to asyncpg so I will be looking at your example and the documentation closely next couple of days. Thank you 👍

adampy commented 4 years ago

Adam-Bot has been migrated from psycopg2 to asyncpg as requested. Thank you for the bringing asyncpg to my attention, Tim!