I have recently started using flink for data processing. When I tried to execute table api for hashtag count by importing pyflink, Im not able to import OldCsv and FileSystem from pyflink.table.descriptors.
I have also downloaded apache-flink using: pip install apache-flink
Libraries imported:
from pyflink.table import DataTypes, TableEnvironment, EnvironmentSettings
from pyflink.table.descriptors import Schema, OldCsv , FileSystem
from pyflink.table.expressions import lit
Code:
t_env.get_config().get_configuration().set_string("parallelism.default", "1")
t_env.connect(FileSystem().path(input_file)) \
.with_format(OldCsv()
.field('word', DataTypes.STRING())) \
.with_schema(Schema()
.field('word', DataTypes.STRING())) \
.create_temporary_table('Source')
error:
File "/home/samarth/Data-Engg/Flink/HashtagCounts/hashtag.py", line 4, in <module>
from pyflink.table.descriptors import Schema, OldCsv , FileSystem
ImportError: cannot import name 'OldCsv' from 'pyflink.table.descriptors' (/home/samarth/.local/lib/python3.8/site-packages/pyflink/table/descriptors.py)
Link followed for the above code:
https://nightlies.apache.org/flink/flink-docs-release-1.13/docs/dev/python/table_api_tutorial/