lazarillo commented on issue #21600:
URL: https://github.com/apache/beam/issues/21600#issuecomment-1873925030
I normally don't add any "me, too" comments, but it has been over 1.5 years
and this issue is still there and it seems there is no follow-up.
In my case, I am receiving this data type from Pub/Sub's publish time:
```python
messages: PCollection[Dict[str, Any]] = (
pipeline
| f"Read Subscript"
>> ReadFromPubSub(
subscription=subscription_full_path,
id_label="message_id",
with_attributes=True,
).with_output_types(PubsubMessage)
| "Decode JSON" >> ParDo(JsonLoad()).with_output_types(dict)
| "Include subscription name"
>> Map(lambda x: {**x, "subscription_name":
subscription}).with_output_types(
dict
)
)
```
(`JsonLoad` is a `DoFn` that is _almost_ exactly just a `Map` of
`json.loads`, but capturing attributes and managing incorrect incoming data.)
The data `PCollection` that I receive from `ReadFromPubSub` includes a
`publish_time` that is `DatetimeWithNanoseconds`:
```python
{
'message_id': '9961304079927039',
...,
'publish_time': DatetimeWithNanoseconds(2024, 1, 2, 10, 16, 22, 762000,
tzinfo=datetime.timezone.utc)
}
```
--
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]