Note For general connector information and common configuration, please refer to the corresponding Java/Scala documentation.
Download connector and format jars
Since Flink is a Java/Scala-based project, for both connectors and formats, implementations are available as jars that need to be specified as job dependencies.
How to use connectors
In PyFink’s Table API, DDL is the recommended way to define sources and sinks, executed via the execute_sql() method on the TableEnvironment. This makes the table available for use by the application.
Below is a complete example of how to use a Kafka source/sink and the JSON format in PyFlink.
Predefined Sources and Sinks
Some data sources and sinks are built into Flink and are available out-of-the-box. These predefined data sources include reading from Pandas DataFrame, or ingesting data from collections. The predefined data sinks support writing to Pandas DataFrame.
PyFlink Tables support conversion to and from Pandas DataFrame.
from_elements() is used to create a table from a collection of elements. The element types must be acceptable atomic types or acceptable composite types.
The above query returns a Table like:
User-defined sources & sinks
In some cases, you may want to define custom sources and sinks. Currently, sources and sinks must be implemented in Java/Scala, but you can define a TableFactory to support their use via DDL. More details can be found in the Java/Scala documentation.