# 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:

  • https://nightlies.apache.org/flink/flink-docs-master/docs/connectors/table/print/

# Code

Code on GitHub: https://github.com/LarryDpk/pkslow-samples

Last Updated: 1/3/2025, 11:31:51 PM