From 3feca0eba7af632bd44660e43dd3697b83cbacb6 Mon Sep 17 00:00:00 2001 From: Shunping Huang Date: Tue, 22 Jul 2025 17:34:05 -0400 Subject: [PATCH] Fix jdbc logical type issues when running a yaml pipeline. --- sdks/python/apache_beam/yaml/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdks/python/apache_beam/yaml/main.py b/sdks/python/apache_beam/yaml/main.py index fbebaea4346f..5747f000cd5f 100644 --- a/sdks/python/apache_beam/yaml/main.py +++ b/sdks/python/apache_beam/yaml/main.py @@ -25,6 +25,13 @@ import apache_beam as beam from apache_beam.io.filesystems import FileSystems +# The following imports force the registration of JDBC logical types. +# When running a Beam YAML pipeline, the expansion service handles JDBCIO using +# Java transforms, bypassing the Python module (`apache_beam.io.jdbc`) that +# registers these types. These imports load the module, preventing a +# "logical type not found" error. +from apache_beam.io.jdbc import JdbcDateType # pylint: disable=unused-import +from apache_beam.io.jdbc import JdbcTimeType # pylint: disable=unused-import from apache_beam.transforms import resources from apache_beam.yaml import yaml_testing from apache_beam.yaml import yaml_transform