Skip to main content

TagoSQL

TagoSQL lets you query your TagoIO data with SQL. Instead of chaining multiple data requests and combining the results in code, you write one query that filters, aggregates, joins, and sorts your data on the server, and get back exactly the rows you need.

SELECT variable, value, time
FROM device('YOUR_DEVICE_ID') AS d
WHERE variable = 'temperature' AND value > 30
ORDER BY time DESC
LIMIT 100

Everything is read-only and automatically scoped to your profile: a query can only read resources that belong to you, and there is no way to remove that scoping.

Why use it

  • One request instead of many. Filtering, aggregation (COUNT, AVG, SUM, MIN, MAX), grouping, and sorting happen in the query. Several data requests plus client-side merging become a single call.
  • Combine data sources. JOIN data from multiple devices, for example to correlate a sensor's readings with an actuator's state by time.
  • Query whole fleets. device_data_by_tag returns the latest reading per device across every device matching a set of tags: one request for a map of last locations or a table of last values. See Available Tables.
  • Write it once, use it everywhere. A TagoSQL query is a resource like a device or an analysis: named, versioned, with its own parameters, cache, and rate limit. Change the query in one place and every consumer picks it up.
  • Built-in protection. Result caching, per-query rate limits, and plan-level guardrails keep a popular or misbehaving query from affecting the rest of your account.

Where to use it

  • Analysis: run a query from your Analysis scripts instead of hand-rolling data pagination and aggregation. An Analysis token can be granted execution and even query management through Access Management.
  • Custom widgets: feed dashboards with pre-aggregated, cached results. The result comes back with typed columns, ready to render as a table or chart.
  • TagoRUN portals: Run-user tokens can be granted access and execution on specific queries, so your end-user portal can list and show reports without exposing anything beyond what the granted queries select.
  • External applications and reports: any system that can call the TagoIO API can execute a query and receive clean tabular data, without learning the shape of the underlying storage.

How it works

  1. Check what data you can query: your device data, entity data, device and entity lists, and whole fleets by tag.
  2. Write and store a query, optionally with parameters so one query serves many inputs.
  3. Execute it from a widget, analysis, or your own application. Enable the result cache for hot queries.
  4. Keep an eye on limits: each plan sets caps for queries, rows, devices per fleet query, and execution rates.

For endpoint-level detail (request and response schemas, every field and status code), use the TagoIO API reference under the SQL Queries section.