Managing Default (Consolidation) Queries


SummaryA basic overview of the types of scheduled queries and specifics on working with default (or Consolidation) queries using various API endpoints.

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

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 query objects as well as create/schedule/delete them by defining and then using the endpoints/functions below.

See the API Reference for more information.

Create default (consolidation) query

Create a new default (consolidation) query.

configuration = {
    "event_type": event_type,
    "run_at": "0 * * * *"
custom_variables = {"role": "PUBLIC"}
api.schedule_default_query(api, configuration, custom_variables=custom_variables)
Creating default (consolidation) queries for webhook-based inputs

For most inputs, you create a consolidation query by passing a configuration to schedule_default_query. For some webhook-based inputs, you'll also need to define custom_variables for the schedule_default_query call. These inputs include:

  • Custom Webhooks

  • iOS/Android App

  • Java App

  • JavaScript App

  • Python App

An example of creating a default query (consolidation) for a webhook-based input in Redshift:

rs_configuration = {"event_type": event, "run_at": "*/15 * * * *", 'query_type': 'incremental'}
rs_custom_variables = {"role": "PUBLIC", 'ri_column': '_metadata__timestamp', 'all_ri_cols': '_metadata__timestamp DESC'}

api.schedule_default_query(configuration=rs_configuration, custom_variables=rs_custom_variables)

An example of creating a default query (consolidation) for a webhook-based input in Snowflake:

sf_configuration = {"event_type": event, "run_at": "*/15 * * * *"}
sf_custom_variables = {"role": "PUBLIC","ri_field":"_metadata.@timestamp", "all_ri_fields": ["_metadata.@timestamp"]}

api.schedule_default_query(configuration=sf_configuration, custom_variables=sf_custom_variables)
Get all scheduled and default (consolidation) queries

Return a list of query objects (custom scheduled as well as default consolidation queries).

Get default query by event type

Return a query object by event type.

Delete default (consolidation) query

Remove a default (consolidation) query by event type.


Search results

    No results found