Flink Print Table Data
It’s a simple example to print table data in Flink.
String printSink = "CREATE TABLE print_sink (\n" +
" id INT,\n" +
" name STRING,\n" +
" age INT\n" +
") WITH (\n" +
" 'connector' = 'print',\n" +
" 'print-identifier' = '[Sink data to console]'\n" +
")";
tableEnv.executeSql(printSink);
tableEnv.executeSql("INSERT INTO print_sink SELECT * FROM csv_source");
Results:
[Sink data to console]:2> +I[1, Larry, 18]
[Sink data to console]:2> +I[2, Jay, 40]
[Sink data to console]:2> +I[3, JJ, 38]
[Sink data to console]:2> +I[4, Dan, 3]
[Sink data to console]:2> +I[5, Eason, 18]
[Sink data to console]:2> +I[6, Katy, 20]
[Sink data to console]:2> +I[7, Jacky, 28]
[Sink data to console]:2> +I[8, Sam, 33]
References:
Code
Code on GitHub: https://github.com/LarryDpk/pkslow-samples