---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ydb.tech/docs/en/recipes/streaming_queries/debug-read.md?version=main
  - https://ydb.tech/docs/ru/recipes/streaming_queries/debug-read.md?version=main
sourcePath: en/core/recipes/streaming_queries/debug-read.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Debug reading from a topic

When developing [streaming queries](https://ydb.tech/docs/en/concepts/streaming-query/streaming-query.md?version=main), it is useful to quickly see what data is coming into a [topic](https://ydb.tech/docs/en/concepts/datamodel/topic.md?version=main) without creating a full streaming query. To do this, you can run a regular `SELECT` with the `STREAMING = "TRUE"` parameter.

{% note warning %}

This method is intended only for debugging and checking data in a topic. For production use, create streaming queries using [CREATE STREAMING QUERY](https://ydb.tech/docs/en/yql/reference/syntax/create-streaming-query.md?version=main).

{% endnote %}

{% note info %}

In the examples:

- `ext_source` — a pre-created [external data source](https://ydb.tech/docs/en/concepts/datamodel/external_data_source.md?version=main).
- `input_topic` — a local or external topic (see [local and external topics in streaming queries](https://ydb.tech/docs/en/dev/streaming-query/local-and-external-topics.md?version=main)).

{% endnote %}

## Reading raw data

The simplest way is to read messages in `raw` format, without parsing the schema:


```sql
SELECT
    Data
FROM
    input_topic -- or external topic ext_source.input_topic
WITH (
    FORMAT = raw,
    SCHEMA = (
        Data String
    ),
    STREAMING = "TRUE"
)
LIMIT 1
```


The `LIMIT` parameter is required — without it, the query will not complete, as it will wait for new messages indefinitely.

## Reading with JSON parsing

If the data in the topic is stored in JSON format, you can immediately parse it by fields:


```sql
SELECT
    *
FROM
    input_topic -- or external topic ext_source.input_topic
WITH (
    FORMAT = json_each_row,
    SCHEMA = (
        Time String NOT NULL,
        Level String NOT NULL,
        Host String NOT NULL
    ),
    STREAMING = "TRUE"
)
LIMIT 5
```


## See also

* [Streaming queries](https://ydb.tech/docs/en/concepts/streaming-query/streaming-query.md?version=main)
* [Data formats for reading/writing from topics](https://ydb.tech/docs/en/dev/streaming-query/streaming-query-formats.md?version=main) — supported data formats
* [Streaming read from a topic](https://ydb.tech/docs/en/yql/reference/syntax/select/streaming.md?version=main) — description of `STREAMING = "TRUE"` in the YQL reference
