DeltaStream
Search
K
Comment on page

PRINT TOPIC

Syntax

PRINT TOPIC
topic_name
[IN STORE store_name]
[WITH (print_parameter = value [, ...])];

Description

This command prints the current data that is streaming through a Topic. By default, this command prints only the latest incoming records. See Print Parameters for additional configuration of this behavior.
Topics will only be visible if the current role has USAGE privileges on the Store.

Arguments

topic_name

This is the name of the Topic to print the content of. For case-sensitive names, the name must be wrapped in double quotes. Otherwise, the lowercase name will be used.

IN STORE store_name

Optionally, sample a Topic from a specific Store. For case-sensitive names, the name must be wrapped in double quotes; otherwise, the lowercase name will be used.

WITH (print_parameter = value [, ...])

Optionally, add Print Parameters for changing the behavior of the output on each printing session.
Parameter Name
Description
from.beginning
A flag that indicates the operation will start reading the Topic from the earliest available records. This property does not accept a value.
Required: No Default value: Unset Type: Flag
from.timestamp
Specifies the timestamp to use to print records. The timestamp value is in epoch-milliseconds, which is measured as the number of milliseconds since January 1, 1970 00:00:00.000 GMT. Cannot be set with the from.beginning flag.
Required: No Default value: None Type: Integer Valid values: [1,...]
message.rate
Specifies the number of records per second that should be printed.
Required: No Default value: 5 Type: Integer Valid values: [1,...,10]

Examples

The following prints from the pageviews Topic using the current Store and default parameter values.
demodb.public/demostore# PRINT TOPIC "pageviews";
{"userid":"User_1"} | {"viewtime":1660931394412,"userid":"User_1","pageid":"Page_22"}
{"userid":"User_6"} | {"viewtime":1660931395412,"userid":"User_6","pageid":"Page_32"}
{"userid":"User_1"} | {"viewtime":1660931396413,"userid":"User_1","pageid":"Page_96"}
....
The following prints from the CaseSensitivePageviews Topic using a specified Store. Note that since the Topic is case-sensitive, we wrap the Topic name in quotes.
demodb.public/demostore# PRINT TOPIC "CaseSensitivePageviews" IN STORE "OtherStore";
{"userid":"User_1"} | {"viewtime":1660931394412,"userid":"User_1","pageid":"Page_22"}
{"userid":"User_6"} | {"viewtime":1660931395412,"userid":"User_6","pageid":"Page_32"}
{"userid":"User_1"} | {"viewtime":1660931396413,"userid":"User_1","pageid":"Page_96"}
....
The following prints from the pageviews Topic from a specific timestamp with a rate of 10 messages per second.
demodb.public/demostore# PRINT TOPIC pageviews WITH ( 'from.timestamp' = 1660931394411, 'message.rate' = 10 );
{"userid":"User_1"} | {"viewtime":1660931394412,"userid":"User_1","pageid":"Page_22"}
{"userid":"User_6"} | {"viewtime":1660931395412,"userid":"User_6","pageid":"Page_32"}
{"userid":"User_1"} | {"viewtime":1660931396413,"userid":"User_1","pageid":"Page_96"}
....
The following prints from the pageviews Topic from the earliest available records.
demodb.public/demostore# PRINT TOPIC pageviews IN STORE teststore WITH ( 'from.beginning', 'message.rate' = 1 );
{"userid":"User_7"} | {"viewtime":11631281,"userid":"User_7","pageid":"Page_83"}
{"userid":"User_1"} | {"viewtime":11631291,"userid":"User_1","pageid":"Page_50"}
{"userid":"User_6"} | {"viewtime":11631301,"userid":"User_6","pageid":"Page_12"}
...
Last modified 1mo ago