1
1
1YaN12019-02-11 15:05:12
Python
1YaN1, 2019-02-11 15:05:12

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

2 answer(s)
D
Denis Sh, 2019-02-11
@Deq56

the simplest, periodically make a request to the database, and changes were made to the client

D
Dmitry Shitskov, 2019-02-11
@Zarom

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 question

Ask a Question

731 491 924 answers to any question