0

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/

  • maybe it works in newest version and you have to update module. OR maybe it was avaliable in old version and removed in new version. You links show message that it is old documentation. OR maybe it needs to install other module to get this function. – furas Nov 23 '21 at 07:21
  • here is link to [newest documentation](https://nightlies.apache.org/flink/flink-docs-release-1.15/) for version `1.15` and I can't find `OldCsv` in this version but I could find in documentation for `1.13` – furas Nov 23 '21 at 07:26

0 Answers0