Skip to content

Datatistics/triggerkit

Repository files navigation

TriggerKit

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.git

or from pypi

$ pip install triggerkit

Usage

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 --verbose

Creating 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 file
  • SNOWFLAKE_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 notifications
  • log_incident: Records incidents in a tracking system
  • generate_report: Creates summary reports from data

About

Python package to drive actions from Snowflake views

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •