Answer the question
In order to leave comments, you need to log in
How to automatically get data from postgresql database using telegram bot?
I have a bot on the pyTelegramBot library, a request was
written
to receive data from the database, but only with the help of the command sent to the bot
I need to automate this process, that is, so that when new data appears in the database, they are immediately sent through the bot to the user
trying to find what then about Listener but could not find anything concrete
Answer the question
In order to leave comments, you need to log in
the simplest, periodically make a request to the database, and changes were made to the client
There was a similar question recently.
Together with each data update put the flag - "updated" in the additional field of the table. Poller, for example, using the sched module, regularly make a selection from the database for this field, simultaneously removing the flag.
The operation to read and set the flag must be one transaction.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question