TriggerKit
A flexible, data action system utilizing Snowflake views
Overview
This system allows you to:
- Define Snowflake views to monitor
- Schedule when to check these views for new data
- Configure actions to trigger when data is available
- Extend with custom actions for your specific needs
Installation
Install latest from the GitHub repository:
$ pip install git+https://github.com/Datatistics/triggerkit.gitor from pypi
$ pip install triggerkitUsage
Run the system with your configuration file:
# Using default config.toml in current directory
snowflake-actions
# Or specify a config file
snowflake-actions --config /path/to/your/config.toml
# To check your configuration file syntax
snowflake-actions --check-config
# To list available actions
snowflake-actions --list-actions
# For verbose logging
snowflake-actions --verboseCreating Custom Actions
You can extend the system with your own custom actions:
import triggerkit as tk
@tk.register("my_custom_action", "Description of what this action does")
def my_custom_action(data: List[Dict]):
"""
Takes in records from Snowflake view and processes them how you want.
Args:
data: List of records from Snowflake
Returns:
Dictionary with action results
"""
# Your custom logic here
return {"processed": len(data)}Environment Variables
CONFIG_PATH: Path to the TOML configuration fileSNOWFLAKE_PASSWORD: Snowflake password (recommended over storing in config)LOG_LEVEL: Set the logging level (DEBUG, INFO, WARNING, ERROR)
Built-in Actions
The system comes with several built-in actions:
send_alert: Sends email and Slack notificationslog_incident: Records incidents in a tracking systemgenerate_report: Creates summary reports from data