Answer the question
In order to leave comments, you need to log in
What database to use for telegram bot?
We need a data store for a telegram bot (database for text messages). Please tell me which database is better to use.
It will be cool if, in addition to answering the question, leave educational material on this database.
Answer the question
In order to leave comments, you need to log in
The simplest sqlite3 https://python-scripts.com/sqlite
maybe even postgreSQL, mysql https://dev-gang.ru/article/rabota-s-postgresql-v-...
https://postgrespro.ru/ docs/postgresql/11/intro-whatis
It all depends on what tasks your bot will have, what architecture it will have, how complex the data models are, whether you are going to use ORM and which one .
Or maybe you don’t need a relational database structure at all and a NoSQL database is more suitable .
there are a great many of them with different capabilities and limitations from simple key-value stores to branchy and fancy ones.
I would recommend MongoDB .
For python, there are a huge number of examples and tutorials like this . Much more understandable.
With Monga, you will avoid the need to fiddle with the database schema, you can avoid the specific process of initializing the database, creating its structure.
If the data that your bot will operate on is diverse, then it’s a good idea to write models in the form of ordinary Python classes, make methods for serialization (saving) in the database and deserialization (loading) and forget about the database as some kind of separate entity. You can concentrate on the logic of work.
I don't really understand the motivation behind your question. Now there are a lot of simple accessible materials on this topic, including in Russian. And how to choose which database to use, I have already described to you. For more detailed advice, there is not enough information about what your bot will do.
PS
I apologize for the captain's references in the text, but what is the question, such is the answer.
PPS
I have to admit that I'm pretty biased in favor of monga. Most likely you will be fine with anything.
Least of all it will require configuration and knowledge, apparently, sqlite. This is an embedded database, it is sharpened for easy use. However, if you suddenly need to run several instances of your bot that will work with the same database, then still look towards MongoDB or Postgres. Mysql has started to lose ground and there is no particular reason not to use postgres if you need a relational database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question