ahmedabu98 commented on code in PR #26100:
URL: https://github.com/apache/beam/pull/26100#discussion_r1158954600


##########
sdks/python/apache_beam/transforms/external.py:
##########
@@ -180,14 +180,52 @@ def _get_named_tuple_instance(self):
 
 
 class SchemaTransformPayloadBuilder(PayloadBuilder):
-  def __init__(self, identifier, **kwargs):
-    self._identifier = identifier
+  def __init__(self, schematransform_config, strict_schema=False, **kwargs):
+    self._schematransform_config = schematransform_config
+    self._strict_schema = strict_schema
     self._kwargs = kwargs
 
+  def _get_schema_proto_and_payload(self, **kwargs):
+    named_fields = []
+    fields_to_values = OrderedDict()
+    external_config_schema_fields = \
+      self._schematransform_config.configuration_schema._fields
+    kwargs_fields = tuple(self._kwargs.keys())
+
+    if self._strict_schema and external_config_schema_fields != kwargs_fields:
+      raise ValueError(
+          "Parameters in kwargs: %s do not match the external "
+          "SchemaTransform's configuration fields: %s" %
+          (kwargs_fields, external_config_schema_fields))
+
+    # The discover API allows us to obtain an ordered configuration schema

Review Comment:
   Sounds good, I like keeping the less costly option as the default. So the 
default can continue using the existing `_get_schema_proto_and_payload()`. 
However, I think we can't use this method for the 
`rearrange_based_on_discovery` option because it builds the payload based off 
kwargs only.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to