Apache Beam SDK for Python¶
Apache Beam provides a simple, powerful programming model for building both batch and streaming parallel data processing pipelines.
The Apache Beam SDK for Python provides access to Apache Beam capabilities from the Python programming language.
Status¶
The SDK is still early in its development, and significant changes should be expected before the first stable version.
Overview¶
The key concepts in this programming model are
PCollection
: represents a collection of data, which could be bounded or unbounded in size.PTransform
: represents a computation that transforms input PCollections into output PCollections.Pipeline
: manages a directed acyclic graph ofPTransform
s andPCollection
s that is ready for execution.PipelineRunner
: specifies where and how the pipeline should execute.Read
: read from an external source.Write
: write to an external data sink.
Typical usage¶
At the top of your source file:
import apache_beam as beam
After this import statement
- Transform classes are available as
beam.FlatMap
,beam.GroupByKey
, etc. - Pipeline class is available as
beam.Pipeline
- Text read/write transforms are available as
beam.io.ReadFromText
,beam.io.WriteToText
.
Examples
The examples subdirectory has some examples.
Subpackages¶
- apache_beam.coders package
- apache_beam.dataframe package
- apache_beam.internal package
- apache_beam.io package
- Subpackages
- apache_beam.io.aws package
- apache_beam.io.external package
- apache_beam.io.flink package
- apache_beam.io.gcp package
- Subpackages
- apache_beam.io.gcp.datastore package
- Subpackages
- apache_beam.io.gcp.datastore.v1new package
- Submodules
- apache_beam.io.gcp.datastore.v1new.adaptive_throttler module
- apache_beam.io.gcp.datastore.v1new.datastore_write_it_pipeline module
- apache_beam.io.gcp.datastore.v1new.datastoreio module
- apache_beam.io.gcp.datastore.v1new.helper module
- apache_beam.io.gcp.datastore.v1new.query_splitter module
- apache_beam.io.gcp.datastore.v1new.types module
- apache_beam.io.gcp.datastore.v1new.util module
- Submodules
- apache_beam.io.gcp.datastore.v1new package
- Subpackages
- apache_beam.io.gcp.experimental package
- apache_beam.io.gcp.datastore package
- Submodules
- apache_beam.io.gcp.big_query_query_to_table_pipeline module
- apache_beam.io.gcp.bigquery module
- apache_beam.io.gcp.bigquery_avro_tools module
- apache_beam.io.gcp.bigquery_file_loads module
- apache_beam.io.gcp.bigquery_io_read_pipeline module
- apache_beam.io.gcp.bigquery_tools module
- apache_beam.io.gcp.bigtableio module
- apache_beam.io.gcp.gcsfilesystem module
- apache_beam.io.gcp.gcsio module
- apache_beam.io.gcp.gcsio_overrides module
- apache_beam.io.gcp.pubsub module
- apache_beam.io.gcp.pubsub_it_pipeline module
- Subpackages
- Submodules
- apache_beam.io.avroio module
- apache_beam.io.concat_source module
- apache_beam.io.filebasedsink module
- apache_beam.io.filebasedsource module
- apache_beam.io.fileio module
- apache_beam.io.filesystem module
- apache_beam.io.filesystemio module
- apache_beam.io.filesystems module
- apache_beam.io.hadoopfilesystem module
- apache_beam.io.iobase module
- apache_beam.io.localfilesystem module
- apache_beam.io.mongodbio module
- apache_beam.io.parquetio module
- apache_beam.io.range_trackers module
- apache_beam.io.restriction_trackers module
- apache_beam.io.source_test_utils module
- apache_beam.io.textio module
- apache_beam.io.tfrecordio module
- apache_beam.io.utils module
- apache_beam.io.vcfio module
- apache_beam.io.watermark_estimators module
- Subpackages
- apache_beam.metrics package
- apache_beam.ml package
- Subpackages
- apache_beam.ml.gcp package
- Submodules
- apache_beam.ml.gcp.cloud_dlp module
- apache_beam.ml.gcp.naturallanguageml module
- apache_beam.ml.gcp.naturallanguageml_test_it module
- apache_beam.ml.gcp.videointelligenceml module
- apache_beam.ml.gcp.videointelligenceml_test_it module
- apache_beam.ml.gcp.visionml module
- apache_beam.ml.gcp.visionml_test_it module
- Submodules
- apache_beam.ml.gcp package
- Subpackages
- apache_beam.options package
- apache_beam.portability package
- Subpackages
- apache_beam.portability.api package
- Submodules
- apache_beam.portability.api.beam_artifact_api_pb2_grpc module
- apache_beam.portability.api.beam_artifact_api_pb2_urns module
- apache_beam.portability.api.beam_expansion_api_pb2_grpc module
- apache_beam.portability.api.beam_fn_api_pb2_grpc module
- apache_beam.portability.api.beam_fn_api_pb2_urns module
- apache_beam.portability.api.beam_interactive_api_pb2_grpc module
- apache_beam.portability.api.beam_job_api_pb2_grpc module
- apache_beam.portability.api.beam_job_api_pb2_urns module
- apache_beam.portability.api.beam_provision_api_pb2_grpc module
- apache_beam.portability.api.beam_runner_api_pb2_grpc module
- apache_beam.portability.api.beam_runner_api_pb2_urns module
- apache_beam.portability.api.endpoints_pb2_grpc module
- apache_beam.portability.api.external_transforms_pb2_grpc module
- apache_beam.portability.api.metrics_pb2_grpc module
- apache_beam.portability.api.metrics_pb2_urns module
- apache_beam.portability.api.schema_pb2_grpc module
- apache_beam.portability.api.standard_window_fns_pb2_grpc module
- apache_beam.portability.api.standard_window_fns_pb2_urns module
- Submodules
- apache_beam.portability.api package
- Submodules
- Subpackages
- apache_beam.runners package
- Subpackages
- apache_beam.runners.dataflow package
- Subpackages
- Submodules
- apache_beam.runners.dataflow.dataflow_exercise_metrics_pipeline module
- apache_beam.runners.dataflow.dataflow_exercise_streaming_metrics_pipeline module
- apache_beam.runners.dataflow.dataflow_metrics module
- apache_beam.runners.dataflow.dataflow_runner module
- apache_beam.runners.dataflow.ptransform_overrides module
- apache_beam.runners.dataflow.test_dataflow_runner module
- apache_beam.runners.direct package
- Submodules
- apache_beam.runners.direct.bundle_factory module
- apache_beam.runners.direct.clock module
- apache_beam.runners.direct.consumer_tracking_pipeline_visitor module
- apache_beam.runners.direct.direct_metrics module
- apache_beam.runners.direct.direct_runner module
- apache_beam.runners.direct.direct_userstate module
- apache_beam.runners.direct.evaluation_context module
- apache_beam.runners.direct.executor module
- apache_beam.runners.direct.helper_transforms module
- apache_beam.runners.direct.sdf_direct_runner module
- apache_beam.runners.direct.test_direct_runner module
- apache_beam.runners.direct.test_stream_impl module
- apache_beam.runners.direct.transform_evaluator module
- apache_beam.runners.direct.util module
- apache_beam.runners.direct.watermark_manager module
- Submodules
- apache_beam.runners.interactive package
- Subpackages
- apache_beam.runners.interactive.caching package
- apache_beam.runners.interactive.display package
- Submodules
- apache_beam.runners.interactive.display.display_manager module
- apache_beam.runners.interactive.display.interactive_pipeline_graph module
- apache_beam.runners.interactive.display.pcoll_visualization module
- apache_beam.runners.interactive.display.pipeline_graph module
- apache_beam.runners.interactive.display.pipeline_graph_renderer module
- Submodules
- apache_beam.runners.interactive.options package
- apache_beam.runners.interactive.testing package
- Submodules
- apache_beam.runners.interactive.background_caching_job module
- apache_beam.runners.interactive.cache_manager module
- apache_beam.runners.interactive.interactive_beam module
- apache_beam.runners.interactive.interactive_environment module
- apache_beam.runners.interactive.interactive_runner module
- apache_beam.runners.interactive.pipeline_analyzer module
- apache_beam.runners.interactive.pipeline_fragment module
- apache_beam.runners.interactive.pipeline_instrument module
- apache_beam.runners.interactive.utils module
- Subpackages
- apache_beam.runners.internal package
- apache_beam.runners.job package
- apache_beam.runners.dataflow package
- Submodules
- Subpackages
- apache_beam.testing package
- Subpackages
- Submodules
- apache_beam.testing.datatype_inference module
- apache_beam.testing.extra_assertions module
- apache_beam.testing.metric_result_matchers module
- apache_beam.testing.pipeline_verifiers module
- apache_beam.testing.synthetic_pipeline module
- apache_beam.testing.test_pipeline module
- apache_beam.testing.test_stream module
- apache_beam.testing.test_stream_service module
- apache_beam.testing.test_utils module
- apache_beam.testing.util module
- apache_beam.tools package
- apache_beam.transforms package
- Submodules
- apache_beam.transforms.combiners module
- apache_beam.transforms.core module
- apache_beam.transforms.create_source module
- apache_beam.transforms.deduplicate module
- apache_beam.transforms.display module
- apache_beam.transforms.environments module
- apache_beam.transforms.external module
- apache_beam.transforms.external_java module
- apache_beam.transforms.external_test_py3 module
- apache_beam.transforms.external_test_py37 module
- apache_beam.transforms.ptransform module
- apache_beam.transforms.sideinputs module
- apache_beam.transforms.stats module
- apache_beam.transforms.timeutil module
- apache_beam.transforms.transforms_keyword_only_args_test_py3 module
- apache_beam.transforms.trigger module
- apache_beam.transforms.userstate module
- apache_beam.transforms.util module
- apache_beam.transforms.window module
- Submodules
- apache_beam.typehints package
- Submodules
- apache_beam.typehints.decorators module
- apache_beam.typehints.decorators_test_py3 module
- apache_beam.typehints.native_type_compatibility module
- apache_beam.typehints.opcodes module
- apache_beam.typehints.schemas module
- apache_beam.typehints.trivial_inference module
- apache_beam.typehints.trivial_inference_test_py3 module
- apache_beam.typehints.typecheck module
- apache_beam.typehints.typecheck_test_py3 module
- apache_beam.typehints.typed_pipeline_test_py3 module
- apache_beam.typehints.typehints module
- apache_beam.typehints.typehints_test_py3 module
- Submodules
- apache_beam.utils package
- Submodules
- apache_beam.utils.annotations module
- apache_beam.utils.interactive_utils module
- apache_beam.utils.plugin module
- apache_beam.utils.processes module
- apache_beam.utils.profiler module
- apache_beam.utils.proto_utils module
- apache_beam.utils.retry module
- apache_beam.utils.subprocess_server module
- apache_beam.utils.thread_pool_executor module
- apache_beam.utils.timestamp module
- apache_beam.utils.urns module
- Submodules