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 2021/06/16 00:57:47 UTC

[GitHub] [beam] ihji commented on a change in pull request #14690: [BEAM-12445] Moving streaming inserts with new client

ihji commented on a change in pull request #14690:
URL: https://github.com/apache/beam/pull/14690#discussion_r652270505



##########
File path: sdks/python/apache_beam/io/gcp/bigquery_tools.py
##########
@@ -1114,29 +1112,16 @@ def insert_rows(
     # BigQuery will do a best-effort if unique IDs are provided. This situation
     # can happen during retries on failures.
     # TODO(silviuc): Must add support to writing TableRow's instead of dicts.
-    final_rows = []
-    for i, row in enumerate(rows):
-      json_row = self._convert_to_json_row(row)
-      insert_id = str(self.unique_row_id) if not insert_ids else insert_ids[i]
-      final_rows.append(
-          bigquery.TableDataInsertAllRequest.RowsValueListEntry(
-              insertId=insert_id, json=json_row))
+    insert_ids = [
+        str(self.unique_row_id) if not insert_ids else insert_ids[i] for i,
+        _ in enumerate(rows)
+    ]
+    rows = [json.loads(json.dumps(r, default=default_encoder)) for r in rows]

Review comment:
       any reason to dump and load? sanity check?




-- 
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:
users@infra.apache.org