Skip to content

Instantly share code, notes, and snippets.

@coco98
Created January 27, 2022 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coco98/72ea4ed133c09b2afa45b7f94c081098 to your computer and use it in GitHub Desktop.
Save coco98/72ea4ed133c09b2afa45b7f94c081098 to your computer and use it in GitHub Desktop.
Clean up Events with a cron trigger
{
"resource_version": 8,
"metadata": {
"version": 3,
"sources": [
{
"name": "default",
"kind": "postgres",
"tables": [
{
"table": {
"schema": "public",
"name": "test"
},
"event_triggers": [
{
"name": "increment_rows",
"definition": {
"enable_manual": false,
"insert": {
"columns": "*"
}
},
"retry_conf": {
"num_retries": 0,
"interval_sec": 10,
"timeout_sec": 60
},
"webhook": "http://localhost:8080/v2/query",
"request_transform": {
"body": "{\n \"type\": \"run_sql\",\n \"args\": {\n \"source\": \"default\",\n \"sql\": \"UPDATE test SET name = concat(name, '1')\"\n }\n}",
"content_type": "application/json",
"template_engine": "Kriti"
}
}
]
}
],
"configuration": {
"connection_info": {
"use_prepared_statements": true,
"database_url": {
"from_env": "HASURA_GRAPHQL_DATABASE_URL"
},
"isolation_level": "read-committed",
"pool_settings": {
"connection_lifetime": 600,
"retries": 1,
"idle_timeout": 180,
"max_connections": 50
}
}
}
}
],
"cron_triggers": [
{
"name": "cleanup_old_events",
"webhook": "http://localhost:8080/v2/query",
"schedule": "* * * * *",
"include_in_metadata": true,
"payload": {},
"request_transform": {
"body": "{\n \"type\": \"run_sql\",\n \"args\": {\n \"source\": \"default\",\n \"sql\": \"DELETE FROM hdb_catalog.event_invocation_logs\"\n }\n}",
"content_type": "application/json",
"template_engine": "Kriti"
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment