From 492cd42907deac7b901330cde1faa9582cd6bbd9 Mon Sep 17 00:00:00 2001 From: Radek Stankiewicz Date: Sat, 4 Oct 2025 12:51:14 +0200 Subject: [PATCH 1/2] get_bq_tableschema was invoked on every dict to row conversion if bq schema is not of tableschema type --- sdks/python/apache_beam/io/gcp/bigquery.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdks/python/apache_beam/io/gcp/bigquery.py b/sdks/python/apache_beam/io/gcp/bigquery.py index 0905ba764deb..5aab1c36998d 100644 --- a/sdks/python/apache_beam/io/gcp/bigquery.py +++ b/sdks/python/apache_beam/io/gcp/bigquery.py @@ -2764,6 +2764,8 @@ def expand(self, input): class ConvertToBeamRows(PTransform): def __init__(self, schema, dynamic_destinations): + if not isinstance(schema, (bigquery.TableSchema, bigquery.TableFieldSchema)): + schema = bigquery_tools.get_bq_tableschema(schema) self.schema = schema self.dynamic_destinations = dynamic_destinations From f8585282c3a7ce383a525be5537547d7c51cf9b2 Mon Sep 17 00:00:00 2001 From: Radek Stankiewicz Date: Sat, 4 Oct 2025 12:53:22 +0200 Subject: [PATCH 2/2] get_bq_tableschema was invoked on every dict to row conversion if bq schema is not of tableschema type --- sdks/python/apache_beam/io/gcp/bigquery.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdks/python/apache_beam/io/gcp/bigquery.py b/sdks/python/apache_beam/io/gcp/bigquery.py index 5aab1c36998d..7310bbdc9fb6 100644 --- a/sdks/python/apache_beam/io/gcp/bigquery.py +++ b/sdks/python/apache_beam/io/gcp/bigquery.py @@ -2764,7 +2764,8 @@ def expand(self, input): class ConvertToBeamRows(PTransform): def __init__(self, schema, dynamic_destinations): - if not isinstance(schema, (bigquery.TableSchema, bigquery.TableFieldSchema)): + if not isinstance(schema, + (bigquery.TableSchema, bigquery.TableFieldSchema)): schema = bigquery_tools.get_bq_tableschema(schema) self.schema = schema self.dynamic_destinations = dynamic_destinations