Updated on 2026-11-06 GMT+08:00

Print Connector

Overview

The Print connector outputs data to the standard output (log) of the TaskManager. It is commonly used during development and debugging to quickly view the output results of Flink SQL jobs.

Table 1 Connector details

Category

Details

Supported type

Result table

Running mode

Batch mode and stream mode

Data format

Not applicable

API type

SQL

Whether result table can be updated or deleted

Yes

Application Scenarios

  • Development and debugging: Quickly verifies the output results of Flink SQL processing logic without setting up external storage.
  • Troubleshooting: Observes the data stream content in real time during job running to locate data processing issues.
  • Data sampling: Views a small number of data samples through the standard output to check the data format and content.

Notes and Constraints

  • It can only be used as a sink and cannot be used as a source.
  • In scenarios with a large amount of data, the performance may be affected. Therefore, you are not advised to use this connector in the production environment.

Syntax Structure

CREATE TABLE {table_name} (
  {column_name} {column_type},
  ...
) WITH (
  'connector' = 'print'
);

WITH Parameters

Parameter

Mandatory

Type

Default Value

Value Range

Description

connector

Yes

String

None

print

Specifies that the connector type is Print.

This parameter is mandatory and must be set to the fixed value print. The Flink runtime loads the corresponding Print SinkFactory based on this value to declare the table as a Print output table.

Usage Example

  • Example 1: Create a minimal Print sink table and directly output data to the TaskManager log.
    -- Create a DataGen source table.
    CREATE TABLE datagen_source (
      id BIGINT,
      name STRING,
      score DOUBLE
    ) WITH (
      'connector' = 'datagen',
      'rows-per-second' = '10',
      'fields.id.kind' = 'sequence',
      'fields.id.start' = '1',
      'fields.id.end' = '100'
    );
    
    -- Create the Print result table.
    CREATE TABLE print_sink (
      id BIGINT,
      name STRING,
      score DOUBLE
    ) WITH (
      'connector' = 'print'
    );
    
    -- Submit the job.
    INSERT INTO print_sink
    SELECT id, name, score
    FROM datagen_source;
  • Example 2: When there are multiple Print sinks in a job, the output of different data streams is distinguished by the identifier prefix.
    -- Create a DataGen source table.
    CREATE TABLE datagen_source (
      user_id INT,
      event_type STRING,
      event_time TIMESTAMP(3),
      WATERMARK FOR event_time AS event_time - INTERVAL '5' SECOND
    ) WITH (
      'connector' = 'datagen',
      'rows-per-second' = '10',
      'fields.user_id.kind' = 'sequence',
      'fields.user_id.start' = '1',
      'fields.user_id.end' = '100'
    );
    
    -- Create the Print result table (with an identifier prefix).
    CREATE TABLE print_sink_with_id (
      user_id INT,
      event_type STRING,
      event_time TIMESTAMP(3)
    ) WITH (
      'connector' = 'print',
      'print-identifier' = 'user-event'
    );
    
    -- Submit the job.
    INSERT INTO print_sink_with_id
    SELECT user_id, event_type, event_time
    FROM datagen_source;

    Example output:

    user-event> +I[1, login, 2024-01-01 10:00:00.000]
    user-event> +I[2, click, 2024-01-01 10:01:00.000]
  • Example 3: Use DataGen to generate simulated data and Print to output the results, building a complete zero-dependency test chain.
    -- Create a DataGen source table.
    CREATE TABLE datagen_source (
      id INT,
      name STRING,
      event_time TIMESTAMP(3),
      WATERMARK FOR event_time AS event_time - INTERVAL '5' SECOND
    ) WITH (
      'connector' = 'datagen',
      'rows-per-second' = '10',
      'fields.id.kind' = 'sequence',
      'fields.id.start' = '1',
      'fields.id.end' = '100'
    );
    
    -- Create the Print result table.
    CREATE TABLE print_sink (
      id INT,
      name STRING,
      event_time TIMESTAMP(3)
    ) WITH (
      'connector' = 'print',
      'print-identifier' = 'debug-output'
    );
    
    -- Submit the job: Write source table data to the result table.
    INSERT INTO print_sink
    SELECT id, name, event_time
    FROM datagen_source;