[root@centos6 bin]# pwd
/root/flink-1.11.1/bin
[root@centos6 bin]# ./pyflink-shell.sh local </root/flink/t1.py
[root@centos6 sql_output]# cat /root/flink/t1.py
exec_env = StreamExecutionEnvironment.get_execution_environment()
exec_env.set_parallelism(1)
t_config = TableConfig()
t_env = StreamTableEnvironment.create(exec_env, t_config)
my_source_ddl = """
create table mySource (
word VARCHAR
) with (
'connector' = 'filesystem',
'format' = 'csv',
'path' = '/tmp/input.csv'
)
"""
my_sink_ddl = """
create table mySink (
word VARCHAR,
`count` BIGINT
) with (
'connector' = 'filesystem',
'format' = 'csv',
'path' = '/tmp/output/sql_output'
)
"""
t_env.execute_sql(my_source_ddl)
t_env.execute_sql(my_sink_ddl)
t_env.from_path('mySource').select('word, 1').insert_into('mySink')
t_env.execute("tutorial_job")