Skip to main content

Refresh hooks for datasets

You can programmatically refresh datasets using hooks. This is most commonly done at the end of data pipeline jobs.

Webhooks

Webhooks can be called from any REST-friendly environment.

curl -H 'Authorization: <YOUR_API_KEY>' \
https://api.modelbit.com/api/c/<WORKSPACE_NAME>/main/datasets/<DATASET_NAME>/refresh

API Keys can be created and manged in Settings.

From Snowflake

You can refresh datasets from Snowflake by calling the Modelbit SQL API:

call modelbit_refresh_dataset('<dataset_name>', '<branch_name>');

You may need to prefix the call to modelbit_refresh_dataset with the database and schema configured within Modelbit.

From dbt

Refreshing datasets during a dbt run can be done in a dbt model's pre_hook or post_hook:

{{ config(
post_hook="call my_db.my_schema.modelbit_refresh_dataset('my_dataset', 'main');"
) }}

Alerts

To be alerted when a refresh of a dataset fails, head to Settings and click Alerting. Connect Slack, if you haven't already, then enable the toggle for Dataset Refreshes.

If a dataset refresh fails you'll get an alert similar to this: