Skip to content

Commands

Jakub Nguyen edited this page Feb 14, 2021 · 7 revisions

All available KafkaQuery commands.

Command Description Example
--help
-h
Lists all available commands & options. --help
--topics Lists all available topics. --topics
--schema <topic_name> Displays information about data format in the specified topic. --schema "pypi_releases_min"
--simple-schema <topic_name> Displays information about data format in the specified topic. --simple-schema "pypi_releases_min"
--update-schema <topic_name>=<avro_Schema> Updates (or adds if not present) the schema contained in the specified file for the specified topic. --update-schema "my_topic"="path/to/schema/mySchema.txt"
--infer-schema <topic_name> Infers the Avro schema from the last record in the specified topic and registers it. --infer-schema "my_topic"
--udf <function1,function2...> Registers the specified User defined functions for usage in queries. --udf "myFolder/MyFunction.java","Multiply.java"
--zookeeper <zookeeper_address> Sets the ZooKeeper address to the specified one for this execution. The default address is taken from the environment variable ZK_ADDR or if not present "localhost:2181" will be used. --zookeeper 192.168.1.10:4242
--kafka <kafka_address> Sets the Kafka address to the specified one for this execution. The default address is taken from the environment variable KAFKA_ADDR or if not present "localhost:9092" will be used. --kafka 192.168.1.10:9161
--query <query>
-q <query>
Executes query using Flink SQL and writes the result to the console. --query "SELECT title FROM pypi_releases_min"
Options for --query
--output:<sink_type>=<id>

-o <sink_type>=<id>
Executes query and writes result to specified output.

Valid entries for sink_type are: kafka (with corresponding id representing the topic name) and socket (with corresponding id representing the port).

Default output channel is console.
-q "SELECT crate.id FROM crate_releases_min" -o socket=1234

-q "SELECT crate.id FROM crate_releases_min" -o kafka=my_topic
--timeout <duration>

-t <duration>
Executes query, terminates the program once there have been no new records for the specified duration (in seconds). -q "SELECT crate.id FROM crate_releases_min" -t 42
--start <start_strategy>

-s <start_strategy>
Executes query, specifying the strategy for retrieving records from Kafka. Valid entries for start_strategy are: earliest (retrieves all records from the topic) and latest (only retrieves records assigned to the topic after query start) -q "SELECT crate.id FROM crate_releases_min" -s earliest
Clone this wiki locally