I have a python script which reads the csv file,create table in bigquery based on data in csv and loads the data into the table on runtime. I want to trigger this script whenever a event occurs like a file arriving on a specified bucket. My Python script is present on vm instance(till now,used to run the script from vm instance). Is there any way to execute this script based on a event trigger ?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
A feature of Google Cloud Storage called 'Object Change Notifications' could come in handy here. This will push a notification to a web hook, where you can use your processing code to handle the event (an example to run this on AppEngine is given here, but you could also implement this as a Flask endpoint for example).
Another option is to use Pub/Sub Notifications in combination with Cloud Storage, in case you are more comfortable with that. You can then use the Pub/Sub Python SDK to listen to a specific topic your events arrive in, and use the code you already wrote to handle these events.