Introduction
Adding comments to SQL text allows you to filter by and group-by custom properties in intermix.io. Queries tagged with the intermix.io - Tagging Specification will automatically be detected by intermix.io.
Follow the below steps to manually add annotations to any query. For example within BI tools or to update SQL strings manually via your ETL workflow system.
Three Ways to Generate Query Annotations
- API
- Web-based tool
- Python SDK
Generating Annotations via "api_annotate" API endpoint
The following API responds with a tag.
https://dashboard.intermix.io/api/api_annotate
The endpoint accepts up to 5 parameters. Here is a usage example:
curl -S -XPOST "https://dashboard.intermix.io/api/api_annotate?app=app1&app_ver=1.1&dag=dag1&task=task1&user=user1"
Response:
{
"annotation": "/* INTERMIX_ID: eyJkYWciOiAiZGFnMSIsICJ2ZXJzaW9uIjogIjEiLCAiYXBwX3ZlciI6ICIxLjEiLCAidXNlciI6ICJ1c2VyMSIsICJmb3JtYXQiOiAiaW50ZXJtaXgiLCAiY2hhcnRfbmFtZSI6ICIiLCAiYXBwIjogImFwcDEiLCAibWV0YSI6IHt9LCAiYXQiOiAiIiwgInRhc2siOiAidGFzazEifQ== */",
"request": "/api/api_annotate?app=app1&app_ver=1.1&dag=dag1&task=task1&user=user1"
}
Generating Annotations via Web Tool
- Log into intermix.io and go to 'Organization Settings' -> 'App Tracing'
- Enter the values that identify your SQL query and hit 'Create'.
- Paste the annotation string to the top of your SQL query.
Generating Annotations with Python SDK
See this article for instructions on using the Python SDK.