Triggering & Scheduling
Running a sync manually is not that useful on its own. The real power of Census is having your syncs run automatically. Once you've got your sync up and running, you can configure your sync to run automatically in several ways:
Schedules let you specify a time and frequency that Census can use to run your sync automatically. You can choose options from weekly all the way to Continuous, which means Census checks your source roughly every minute for new changes.
To remove a schedule from a sync, click the edit icon and select Manual from the drop down list.
The last scheduling option is Cron. Cron lets you schedule syncs on arbitrary schedules such as every 3 hours, or only week days. Census accepts standard Cron definitions up to minute granularity (second-level granularity cron definitions are not supported). A Cron schedule is specified by a series of five values, separated by spaces. In order, the values are Minute-of-hour, hours-of-day, Days-of-month, Months-of-year, and Day-of-week. The timezone is UTC.
Here's a few examples of common Cron schedules:
- Once an hour, on the hour, every four hours:
0 */4 * * *
- Hourly during weekdays:
0 * * * 1,2,3,4,5
- Minutely on the 5th, 6th, and 7th hours of the day in UTC timezone:
0 5,6,7 * * *, executes sync jobs at 9pm, 10pm and 11pm PST or 12am, 1am and 2am EST
Please note: If including a range in your CRON schedule you'll want to make sure the values in the range are in a comma separated list.
Hourly during weekdays should be:
0 * * * 1,2,3,4,5instead of
0 * * * 1-5
If you're using dbt Cloud to run your dbt project, you can configure Census to automatically run syncs whenever your models have been rebuilt. Simply select your dbt Cloud project's job to monitor and Census will automatically trigger a sync when it completes.
- dbt strongly recommends you use a Service Account token, though User API keys with the correct permissions are accepted. Service Account tokens can be created by users with Account Admin (Enterprise plan) or Owner (Team plan) permissions.
With your token in hand, you can now connect dbt Cloud to your dbt project.
Now, you'll be able to use a dbt Cloud job to trigger syncs. Visit the Configuration tab of any of your syncs.
If you use Fivetran to load data into your data warehouse, or make use of their data transformations, you can trigger Census syncs to run once that work has completed.
To connect Census to Fivetran, you'll first need an API key and secret associated with an Account Admin user.
- 2.Copy and paste your Fivetran API Key and Secret. Press Verify to confirm they were copied correctly and have the correct permissions. Save your settings.
Now you'll be able to select a Fivetran Connector or Transformation to trigger syncs. Visit the Configuration tab of any of your syncs.
If your syncs have dependencies and you'd like to organize them to run in order, you can use a Sequence. A Sequence runs a dependent sync whenever its specified parent sync completes successfully. Sequences can be found on the sync configurations page:
Each sync can also be triggered via API. On the sync configuration page, you can access the trigger API endpoint for the sync.
An empty HTTP POST call to this endpoint will trigger the sync (no need to provide any data in the body). You can use this API to automatically trigger Census syncs as part of your data pipeline, running syncs once the models they depend on have been rebuilt.
curl -X POST https://bearer:[API_TOKEN]@app.getcensus.com/api/v1/syncs/[SYNC_ID]/trigger
You can use the
sync_run_idreturned when successfully triggering a sync execution and get status on its progress or determine when it has completed.
Heads up: Unlike Airflow 2, Airflow 1 doesn't show any non-"core" providers (i.e. Census!) in the connections UI. If you're using Airflow 1, Census should be configured as an "HTTP" Conn Type, as documented here.