Streaming read from a topic
You can read data from a topic using a regular SELECT without creating a streaming query. To do this, specify STREAMING = "TRUE" in the WITH block and set a limit on the number of output rows via LIMIT; otherwise, the query will not complete.
Warning
This method is intended only for debugging and checking data in a topic. For production processes, create streaming queries using CREATE STREAMING QUERY.
Note
In the examples:
ext_sourceis a pre-created external data sourceinput_topicis a local or external topic.
For more information, see local and external topics in streaming queries.
Example
SELECT
Data
FROM
ext_source.input_topic -- or local topic input_topic
WITH (
FORMAT = raw,
SCHEMA = (
Data String
),
STREAMING = "TRUE"
)
LIMIT 1
See also
- Debug reading from a topic — recipe with additional examples
- Streaming queries
- CREATE STREAMING QUERY
Was the article helpful?
Previous
Next