Introduction

Running Automations in DataSiv

DataSiv enables you to run scripts that call APIs in other parts of the platform, and run on a periodic basis in the background.

All variables will be accessible in the event field, which is in turn a dictionary of key, value pairs. E.g. to access sampleVariable, use event['sampleVariable']

Registering Reusable Queries

To run reusable queries, register them on the queries tab on the right and click save. This will enable your current automation to reference these reusable queries.

🚧

Current code calls have a timeout limit of 25 minutes

If you have scripts that run longer than 25 minutes, please contact us at [email protected].

In the example above, here's what the code would look like to run the reusable query:

import json
import execute_reusable_query

def handler(event, context):
    response = execute_reusable_query(query_id=4, variables={"startDate":"","endDate":""})
    return {
        'statusCode': 200,
        'body': json.dumps('Hello World ' + str(event['sampleVariable']))
    }

🚧

All parameters and variable arguments to the internal API endpoint must be encoded as a string

For example, '{"message":"Hello World"}', or if message was an array it would be '{"message":"['a', 'b']"}'

If everything runs properly you should see a message as above.

Running Tasks Periodically

If you go to https://www.datasiv.io/automations and click on the "Scheduled Runs" column, you should be able to schedule runs to run on a periodic basis. Currently DataSiv supports cron or repeat syntax