Storing Data

Sometimes, you need to store a user's data somewhere. For example, you might be making an economy bot and will hence need to store the amount of coins, items, and other things they have. For this, you will need to use a DB.

What is a DB?

DB stands for Database. Databases are used to store various kinds of data. There are different modules you can use to store the data in a DB, based on your needs.

Which DB should I use?

Some DBs store the data in a key-value format, like,

While some others store it in tables, like,

So, you can choose your DB based on what you need to store.

SQLITE3 is a build-in module is Python. It is simple to use once you learn it - to create a table to store your data all you need to use is CREATE TABLE name (column1, column2). It uses the table format. However, it is recommended you use AIOSQLITE for Discord Bots

AIOSQLITE provides a friendly, async interface to sqlite databases. It works the same way as SQLITE. Recommended over sqlite.

POSTGRESQL is an open source relational database management system (DBMS). It might be a little hard for beginners, but efficient.

MONGODB stores the data in key-value format.

MYSQL MySQL is an open-source relational database management system.

REDIS Redis is an in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker, with optional durability.

Last updated