Hi Jiazhi, you can use a rich function and query all static data in open [1] as you'd do it in Java if you want to load the data into main memory. If you want to dynamically query the database (enriching a record), you should use Async IO instead. [2]
Alternatively, you can also use the data source directly in table API. [3] [1] https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/user_defined_functions.html#rich-functions [2] https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/stream/operators/asyncio.html [3] https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/jdbc.html#how-to-create-a-jdbc-table On Wed, Nov 18, 2020 at 5:00 PM ゞ野蠻遊戲χ <zhoujiazhi1...@vip.qq.com> wrote: > Hi all > > How to use DataStream to load mysql data into the memory of flink > task when the task is initialized? Please give me a demo. > > Thanks, > Jiazhi > > > -- Arvid Heise | Senior Java Developer <https://www.ververica.com/> Follow us @VervericaData -- Join Flink Forward <https://flink-forward.org/> - The Apache Flink Conference Stream Processing | Event Driven | Real Time -- Ververica GmbH | Invalidenstrasse 115, 10115 Berlin, Germany -- Ververica GmbH Registered at Amtsgericht Charlottenburg: HRB 158244 B Managing Directors: Timothy Alexander Steinert, Yip Park Tung Jason, Ji (Toni) Cheng