Skip to content

Commit

Permalink
[FLINK-27564][python] Separate different connectors into separate pac…
Browse files Browse the repository at this point in the history
…kages

This closes #19711.
  • Loading branch information
dianfu committed May 13, 2022
1 parent 1e39821 commit 3595a73
Show file tree
Hide file tree
Showing 10 changed files with 1,803 additions and 1,625 deletions.
1,625 changes: 0 additions & 1,625 deletions flink-python/pyflink/datastream/connectors.py

This file was deleted.

62 changes: 62 additions & 0 deletions flink-python/pyflink/datastream/connectors/__init__.py
@@ -0,0 +1,62 @@
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
from pyflink.datastream.connectors.base import Sink, Source
from pyflink.datastream.connectors.file_system import (FileEnumeratorProvider, FileSink, FileSource,
BucketAssigner, FileSourceBuilder,
FileSplitAssignerProvider, OutputFileConfig,
RollingPolicy,
StreamFormat, StreamingFileSink)
from pyflink.datastream.connectors.jdbc import JdbcSink, JdbcConnectionOptions, JdbcExecutionOptions
from pyflink.datastream.connectors.kafka import FlinkKafkaConsumer, FlinkKafkaProducer, Semantic
from pyflink.datastream.connectors.number_seq import NumberSequenceSource
from pyflink.datastream.connectors.pulsar import PulsarDeserializationSchema, PulsarSource, \
PulsarSourceBuilder, SubscriptionType, StartCursor, StopCursor
from pyflink.datastream.connectors.rabbitmq import RMQConnectionConfig, RMQSource, RMQSink


__all__ = [
'Sink',
'Source',
'FileEnumeratorProvider',
'FileSink',
'FileSource',
'BucketAssigner',
'FileSourceBuilder',
'FileSplitAssignerProvider',
'FlinkKafkaConsumer',
'FlinkKafkaProducer',
'Semantic',
'JdbcSink',
'JdbcConnectionOptions',
'JdbcExecutionOptions',
'NumberSequenceSource',
'OutputFileConfig',
'PulsarDeserializationSchema',
'PulsarSource',
'PulsarSourceBuilder',
'SubscriptionType',
'RMQConnectionConfig',
'RMQSource',
'RMQSink',
'RollingPolicy',
'StartCursor',
'StopCursor',
'StreamFormat',
'StreamingFileSink',
'SubscriptionType'
]
50 changes: 50 additions & 0 deletions flink-python/pyflink/datastream/connectors/base.py
@@ -0,0 +1,50 @@
################################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
from typing import Union

from py4j.java_gateway import JavaObject

from pyflink.datastream.functions import JavaFunctionWrapper


class Source(JavaFunctionWrapper):
"""
Base class for all unified data source in Flink.
"""

def __init__(self, source: Union[str, JavaObject]):
"""
Constructor of Source.
:param source: The java Source object.
"""
super(Source, self).__init__(source)


class Sink(JavaFunctionWrapper):
"""
Base class for all unified data sink in Flink.
"""

def __init__(self, sink: Union[str, JavaObject]):
"""
Constructor of Sink.
:param sink: The java Sink object.
"""
super(Sink, self).__init__(sink)

0 comments on commit 3595a73

Please sign in to comment.