The Print connector writes each row to the standard output or standard error stream of the TaskManager. Use it during development to inspect intermediate results or verify final output without configuring a production sink.
Print connector output appears in TaskManager logs, not in the Flink Web UI console. Set the TaskManager log level to INFO to see the output.
Supported capabilities
| Item | Description |
|---|---|
| Table type | Result table and data ingestion sink |
| Running mode | Batch mode and streaming mode |
| Data format | N/A |
| Metric | N/A |
| API type | SQL API and data ingestion YAML API |
| Data update or deletion in a sink table | Supported |
Use cases
-
Development testing: Add a Print result table alongside your existing sink to verify that the correct rows are flowing through before writing to a production system.
SQL
Syntax
CREATE TABLE print_table (
a INT,
b VARCHAR
) WITH (
'connector' = 'print',
'logger' = 'true'
);
To mirror an existing table schema without redefining columns, use the LIKE clause:
CREATE TABLE print_table WITH ('connector' = 'print')
LIKE table_source (EXCLUDING ALL)
Parameters
| Parameter | Description | Data type | Required | Default value |
|---|---|---|---|---|
connector |
The connector type. Set to print. |
String | Yes | — |
logger |
Whether to display output in the console. | Boolean | No | false |
print-identifier |
A label prepended to each output line. Use this to distinguish results when multiple Print sinks are active. | String | No | — |
sink.parallelism |
The parallelism of the Print sink. | Int | No | Same as upstream |
Data ingestion
For data ingestion YAML jobs, use the values connector with print.enabled: true to route output to logs or out files.
Syntax
source:
type: xxx
sink:
type: values
name: Values Sink
print.enabled: true
Parameters
| Parameter | Description | Data type | Required | Default value |
|---|---|---|---|---|
type |
The sink connector type. Set to values. |
STRING | Yes | — |
name |
A display name for the sink. | STRING | No | — |
print.enabled |
Enables print behavior. Set to true. |
BOOLEAN | Yes | — |
sink.print.standard-error |
Whether to write output to stderr instead of stdout. | BOOLEAN | No | false |
sink.print.logger |
Whether to display output in the console. | BOOLEAN | No | false |
sink.print.limit |
The maximum number of records to print. | LONG | No | 2000 |
materialized.in.memory |
Whether to persist binary log events to memory. | BOOLEAN | No | false |
error.on.schema.change |
Whether to raise an error when a schema change occurs. | BOOLEAN | No | false |
Examples
SQL result table
The following example reads from a source table and writes all rows to a Print sink. Check TaskManager logs to see the output.
CREATE TEMPORARY TABLE table_source (
name VARCHAR,
score BIGINT
) WITH (
...
);
CREATE TEMPORARY TABLE print_sink (
name VARCHAR,
score BIGINT
) WITH (
'connector' = 'print'
);
INSERT INTO print_sink SELECT * FROM table_source;
Data ingestion sink
The following example ingests data from MySQL and prints all rows to the out file.
source:
type: mysql
name: MySQL Source
hostname: ${mysql.hostname}
port: ${mysql.port}
username: ${mysql.username}
password: ${mysql.password}
tables: ${mysql.source.table}
server-id: 7601-7604
sink:
type: values
name: Values Sink
print.enabled: true
Limitations
-
Log level: Set the TaskManager log level to INFO to see Print connector output. Output is written to TaskManager logs, not the Flink Web UI console.
-
Record limit: TaskManager.out displays a maximum of 2,000 log entries. To inspect specific rows when the data volume is large, add a
WHEREclause to filter rows before they reach the Print sink.