TAGS
Resource tags for SIMs, devices, groups, and VPGs.
Use TAGS to look up human-readable names and other tag values for resources. A common tag has NAME = 'name'.
RESOURCE_TYPE values are lowercase in public examples, such as subscriber, device, and group. When joining subscriber tags to SIM data, subscriber tags use IMSI as RESOURCE_ID, not SIM_ID.
Public Contract
- Rows are limited to the current SORACOM Query request context.
Data Freshness
Updated as tag data changes.
Columns
| Column | Type | Description |
|---|---|---|
| RESOURCE_TYPE | TEXT | Type of tagged resource. |
| RESOURCE_ID | TEXT | Unique identifier of the tagged resource. |
| VALUE | TEXT | Tag value. |
| NAME | TEXT | Tag name. |
| RESOURCE_SUMMARY | VARIANT | Additional resource attributes. |
| CREATED_AT | TIMESTAMP_NTZ | When the tag was created. |
Common Queries
Human-readable names for resources:
SELECT
RESOURCE_TYPE,
RESOURCE_ID,
VALUE AS display_name
FROM TAGS
WHERE NAME = 'name';
When joining TAGS with SIM data, subscriber tags use IMSI as RESOURCE_ID, not SIM_ID. Join TAGS to SIM_SNAPSHOTS or SIM_STATS on IMSI, and use lowercase RESOURCE_TYPE values such as subscriber, device, and group.
Join SIM snapshots to subscriber tags:
SELECT
ss.SIM_ID,
ss.IMSI,
t.VALUE AS display_name,
ss.STATUS
FROM SIM_SNAPSHOTS ss
LEFT JOIN TAGS t
ON ss.IMSI = t.RESOURCE_ID
AND t.RESOURCE_TYPE = 'subscriber'
AND t.NAME = 'name';
Join SIM usage to group names:
SELECT
ss.GROUP_ID,
tg.VALUE AS group_name,
SUM(st.DOWNLINK_BYTES) AS total_downlink_bytes,
SUM(st.UPLINK_BYTES) AS total_uplink_bytes,
SUM(st.DOWNLINK_BYTES + st.UPLINK_BYTES) AS total_bytes
FROM SIM_STATS st
JOIN SIM_SNAPSHOTS ss
ON st.SIM_ID = ss.SIM_ID
LEFT JOIN TAGS tg
ON ss.GROUP_ID = tg.RESOURCE_ID
AND tg.RESOURCE_TYPE = 'group'
AND tg.NAME = 'name'
GROUP BY ss.GROUP_ID, tg.VALUE
ORDER BY total_bytes DESC;