Documentation

Managing Custom Scheduled Queries

Abstract

SummaryAn overview of the types of scheduled queries and how to work with custom scheduled queries using various API methods.

With Alooma there are two types of queries, both of which are scheduled: Consolidation (or default) and Custom scheduled queries. For more information about queries see Queries. Here, we'll focus on scheduled queries.

You could use a scheduled query to do something like take a snapshot of a table every night to create a log table.

Query functions

Just like with all other API work, it all begins with authenticating and getting an API instance. Once you have an API Instance, you can get a list of scheduled queries as well as create/schedule and delete them by using the methods below.

Get all scheduled queries

Use get_queries() to return a list of scheduled queries. You can also retrieve the list of any scheduled queries that did not run successfully on the last attempt.

api.get_queries()
# in error state
api.get_scheduled_queries_in_error_state()

Create a scheduled query

Use schedule_query() to create a custom scheduled query specifying the event type, query, and either the frequency or the schedule, but not both. You can use a cron-like string for the value of run_at.Schedule Syntax