pyflink-json文件接收器?

6kkfgxo0  于 2021-06-21  发布在  Flink
关注(0)|答案(1)|浏览(657)

在表api和/或datastreamapi中使用json文件接收器的方式是否与csv相同?
谢谢!
代码

my_sink_ddl = f"""
    create table mySink (
        id STRING,
        dummy_item STRING
    ) with (
        'connector.type' = 'filesystem',
        'format.type' = 'json',
        'connector.path' = 'output.json'
    )
"""

错误

TableException: findAndCreateTableSink failed.
niknxzdl

niknxzdl1#

是的,根据jira flink-17286 integrate json to file system connector和相应的pull请求[flink-17286][connectors/filesystem]integrate json to file system connector#12010,可以从flink开始 1.11 . 在Flink之前 1.11 我相信没有人支持。
您需要使用以下配置:

... with (
        'connector' = 'filesystem',
        'format' = 'json',
        'path' = 'output_json' -- This must be a directory
    )

加上以下环境定义:

t_env = BatchTableEnvironment.create(   environment_settings=EnvironmentSettings.new_instance().in_batch_mode().use_blink_planner().build())

相关问题