Search code examples
pythonpython-2.7google-app-enginegoogle-bigqueryautobahn

BigQuery triggers for a data notification server


I am writing a notification server to provide real time updates to ui. This is done using autobahn with python to achieve something like this. So my data resides in Bigquery. I want to send notifications to ui as soon as data updates in my table. Since there is no SQL triggers for bigquery I thought of having this scenario for that.

  1. Create a task scheduling provided in Appengine.

  2. Use a table decorator inside the job to execute every second.

eg: SELECT COUNT(*) FROM [digin_duosoftware_com.test123@-1-]

Or even a simple query to respond with data every second.

My question is it acceptable to have this implementation for such scenario since I run it every second? or is there any other way to achieve this?

I referred this as well.


Solution

  • as per table decoration use:
    relative value for time in decorator must be in milliseconds

    eg: SELECT COUNT(*) FROM [digin_duosoftware_com.test123@-1000-]
    

    I want to send notifications to ui as soon as data updates in my table

    Instead of polling from data itself - you can rather use tables.get API to check lastModifiedTime table's property and then act based on it