Log Snowflake query results every 5 minutes
Recipe ToolsMarketingDatabase
What it does
When the clock triggers every 5 minutes, this automation runs custom SQL queries against Snowflake. Results from each query pattern are logged to the job report for review.
Who it's for
Data and analytics teams who need to monitor Snowflake tables on a schedule and track query results in logs.
How teams use this
Monitor table changes on schedule
Run queries every 5 minutes to check for new or updated rows in Snowflake and log the results. The team sees a continuous audit trail of what changed.
Alert on specific conditions
Extend this automation to add a condition that checks if query results meet a threshold, then send a notification to a Slack channel when the condition is true. Only alerts go out when data matches the rule.
Export results to a data warehouse
Retarget the logged results to flow into a separate data warehouse or analytics tool instead of just the job report. The same queries run but the output destination changes.
How it works
- Start on a 5-minute interval. The clock begins this automation every 5 minutes so queries run continuously without manual intervention.
- Set up query variables. Create variables for order by, limit, offset, and table name so queries can be customized and reused across multiple Snowflake select operations.
- Run custom SQL queries. Execute custom SQL queries against the AUTOMATION_SELECT_ROWS table in Snowflake with different patterns: no filters, bind variables with output fields, a where condition, and all fields returned.
- Log query results. Write results from all Snowflake queries to the job report so the team can review what data was returned and verify each query pattern worked as expected.