Converting SQL to TQL
Paid plans only
API access — including running queries — is available on TelemetryDeck's paid plans. If your organization is on the free plan, upgrade your plan first and you'll be able to generate a personal access token and run queries.
Authorization
You need a personal access token to authenticate against the TelemetryDeck API. Our article Getting a Personal Access Token explains how to generate one from your dashboard.
Sometimes you start with an SQL query, but want to later convert it to TQL to have a more structured query you can fine-tune.
Running the query¶
POST your query to the /api/v4/query/sql/convert endpoint. The endpoint accepts SQL and returns an equivalent TQL query.
{
"aggregations": [{ "fieldName": "count", "name": "a0", "type": "longSum" }],
"dimension": {
"dimension": "type",
"outputName": "d0",
"outputType": "STRING",
"type": "default"
},
"granularity": { "type": "all" },
"metric": { "metric": "a0", "type": "numeric" },
"queryType": "topN",
"threshold": 10
}