You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/02 07:23:29 UTC

[GitHub] [beam] harrydrippin commented on pull request #17518: [BEAM-10785] Add support for coder argument in WriteToBigQuery

harrydrippin commented on PR #17518:
URL: https://github.com/apache/beam/pull/17518#issuecomment-1144535142

   @pabloem The problem in my case was occurred when I was processing the chat data including emojis and putting it into BigQuery (they were all replaced to replacement character), so our major need in this problem was to disable `ensure_ascii` from `True` to `False` on  `json.dumps()`. But there was no exposed control for replacing that argument, so I temporarily customized `RowAsDictJsonCoder` and `WriteToBigQuery` in my environment like below:
   
   ```python
   class CustomRowAsDictJsonCoder(coders.Coder):
   
       def encode(self, table_row):
           try:
               # ...
               return json.dumps(table_row, ensure_ascii=False, default=default_encoder).encode("utf-8")
               #                            ------------------
           # except: ...
   ```
   
   I also prefer to not define any additional parameters if possible, but I thought that we don't have any possible way to modify parameters inside the coder, or replace the coder. Please correct me if you have any concern over this. 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org