2
%pyflink
from pyflink.table import EnvironmentSettings, StreamTableEnvironment

env_settings = EnvironmentSettings.in_streaming_mode()
table_env = StreamTableEnvironment.create(environment_settings=env_settings)

Will fail with the following context:

AttributeError                            Traceback (most recent call last)
<ipython-input-48-cfd5e4663f51> in <module>
      1 from pyflink.table import EnvironmentSettings, StreamTableEnvironment
      2 
----> 3 env_settings = EnvironmentSettings.in_streaming_mode()
      4 table_env = StreamTableEnvironment.create(environment_settings=env_settings)

AttributeError: type object 'EnvironmentSettings' has no attribute 'in_streaming_mode'

I am running a Zeppelin notebook in AWS Kinesis Data analytics and all of the documentation suggests that this is the correct way to initial the environment.

This was pulled directly from their getting started repository amazon-kinesis-data-analytics-java-examples python\GettingStarted\getting-started.py

According to flink docs examples

t_env = TableEnvironment.create(EnvironmentSettings.in_streaming_mode())

is sufficient but alas it fails for the same reason.

And showcased in the API docs themselves here

I cannot find an example where in_streaming_mode() is not called but it isn't an attribute on the EnvironmentSettings.

What am I doing wrong? Where is some worthwhile documentation on this stuff?

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
hi im Bacon
  • 374
  • 1
  • 12
  • I'm having the same issue - very frustrating that examples in Flink's own documentation don't work. – swooders Aug 18 '23 at 02:25

1 Answers1

0

Zepppelin comes with built-in envs already initialized. Use either:

%flink.ipyflink

print(bt_env, st_env)
<pyflink.table.table_environment.BatchTableEnvironment object at 0x7fbc0fb2c970> 
<pyflink.table.table_environment.StreamTableEnvironment object at 0x7fbc0f6c6c10>
felipe
  • 7,324
  • 2
  • 28
  • 37