1

I am writing a pyqt5 qui that interfaces with my psql DB via SQslDatabase. External-to-me processes have a listen/notify setup to communicate status to other components via the database. So, my gui needs to listen, as well as send notifications. I setup listeners successfully with QSqlDriver (QSqlDriver.subscribeToNotification() func and QSqlDriver.notification() event) as described here, but is there a way of sending notifications on a specified channel with a specified payload?

My current workaround is doing this via a direct DB query. Here's a stripped down version of the code:

db = QSqlDatabase.addDatabase('QPSQL') #DB connection setup elsewhere in the code
query = QSqlQuery(db)
query_str = "NOTIFY some_channel, 'some payload';"
query.exec_(query_str)

My listener catches this successfully. But since the driver provides a function for listening to notify messages, I'm wondering if there is a function call for sending messages too.

1
  • Any suggestions? Commented Aug 30, 2022 at 14:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.