lukecwik commented on a change in pull request #12806: URL: https://github.com/apache/beam/pull/12806#discussion_r491206866
########## File path: sdks/python/apache_beam/io/gcp/pubsub.py ########## @@ -290,21 +290,26 @@ def __init__(self, topic, id_label, with_attributes, timestamp_attribute) @staticmethod - def to_proto_str(element): + def message_to_proto_str(element): # type: (PubsubMessage) -> bytes if not isinstance(element, PubsubMessage): raise TypeError( 'Unexpected element. Type: %s (expected: PubsubMessage), ' 'value: %r' % (type(element), element)) return element._to_proto_str() + @staticmethod + def bytes_to_proto_str(element): + # type: (bytes) -> bytes + msg = pubsub.types.pubsub_pb2.PubsubMessage() + msg.data = element + return msg.SerializeToString() + def expand(self, pcoll): if self.with_attributes: Review comment: After a video meeting, we should update the Dataflow translation for v2 to always pass through the `has_attributes` version for the sink part (aka Write transform in Python) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org