MCPcopy Create free account
hub / github.com/decodableco/examples / hello_pyflink

Function hello_pyflink

pyflink-intro/apps/hello/hello_table_api_sql.py:7–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6
7def hello_pyflink():
8
9 # environment
10 t_env = TableEnvironment.create(EnvironmentSettings.in_streaming_mode())
11
12 # source table (in-mem data generator)
13 t_env.execute_sql("""
14 CREATE TABLE generator_source (
15 num BIGINT
16 ) WITH (
17 'connector' = 'datagen',
18 'rows-per-second' = '1'
19 )""")
20
21 # sink table (printer to stdout)
22 t_env.execute_sql("""
23 CREATE TABLE print_sink (
24 num BIGINT,
25 hello STRING
26 ) WITH (
27 'connector' = 'print'
28 )""")
29
30 # read source -> process -> write sink
31 # using INSERT INTO ... SELECT ... FROM
32 t_env.execute_sql("""
33 INSERT INTO print_sink SELECT ABS(num) % 10 AS num, 'hello 🐍 pyflink 🐿️ ' AS hello FROM generator_source"""
34 ).wait()
35
36
37if __name__ == '__main__':

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected