Streaming reads from a topic

You can read from a topic with a regular SELECT without creating a streaming query. Set STREAMING = TRUE in the WITH block and limit output rows with LIMIT; otherwise the query does not complete.

Warning

Use this only for debugging and inspecting topic data. For production workloads, create streaming queries with CREATE STREAMING QUERY.

Note

In the examples, ydb_source is a pre-created external data source, and topic_name is a topic available through it.

Example

SELECT
    Data
FROM
    ydb_source.topic_name
WITH (
    FORMAT = raw,
    SCHEMA = (
        Data String
    ),
    STREAMING = TRUE
)
LIMIT 1

See also