# query\_tags

## Description

Exposes key/value tags attached to queries. Tags can be used to annotate and categorize queries for filtering and reporting. Only tags for queries on which the current role has USAGE privileges are returned.

## Syntax

```sql
SELECT * FROM deltastream.sys."query_tags";
```

## Columns

| Column            | Type           | Nullable | Description                                                         |
| ----------------- | -------------- | -------- | ------------------------------------------------------------------- |
| `key`             | VARCHAR        | No       | Tag key.                                                            |
| `value`           | VARCHAR        | No       | Tag value.                                                          |
| `query_id`        | VARCHAR        | No       | Unique identifier of the query this tag is attached to.             |
| `organization_id` | VARCHAR        | No       | The unique identifier of the organization this resource belongs to. |
| `created_at`      | TIMESTAMP\_LTZ | No       | Timestamp when the tag was created.                                 |
| `updated_at`      | TIMESTAMP\_LTZ | No       | Timestamp when the tag was last updated.                            |

## Examples

```sh
$ dsql -e 'SELECT * FROM deltastream.sys."query_tags";'
[{"key":"a","value":"b","query_id":"0196fef1-7f99-785b-b80d-4d1813384080","organization_id":"00000000-0000-0000-0000-000000000001","created_at":"2025-08-11T22:00:39.652Z","updated_at":"2025-08-11T22:00:39.652Z"},{"key":"a","value":"b1","query_id":"0196fef1-7f99-785b-b80d-4d1813384080","organization_id":"00000000-0000-0000-0000-000000000001","created_at":"2025-08-11T22:01:08.189Z","updated_at":"2025-08-11T22:01:08.189Z"}]
```

Find all tags for a specific query:

```sql
SELECT key, value FROM deltastream.sys."query_tags" WHERE query_id = '0196fef1-7f99-785b-b80d-4d1813384080';
```

## See Also

* [System Tables Overview](https://docs.deltastream.io/reference/sql-syntax/systables)
* [queries](https://docs.deltastream.io/reference/sql-syntax/systables/queries)
