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/03/15 22:15:53 UTC

[GitHub] [beam] y1chi commented on a change in pull request #14237: [BEAM-11979] Ignore not serializable filter fields in python MongoDBI…

y1chi commented on a change in pull request #14237:
URL: https://github.com/apache/beam/pull/14237#discussion_r594720288



##########
File path: sdks/python/apache_beam/io/mongodbio.py
##########
@@ -264,9 +264,13 @@ def display_data(self):
     res['uri'] = _mask_uri_password(self.uri)
     res['database'] = self.db
     res['collection'] = self.coll
-    res['filter'] = json.dumps(self.filter)
+    res['filter'] = json.dumps(
+        self.filter, default=lambda x: 'not_serializable(%s)' % str(x))
     res['projection'] = str(self.projection)
-    res['mongo_client_spec'] = json.dumps(_mask_spec_password(self.spec))
+    res['mongo_client_spec'] = json.dumps(
+        _mask_spec_password(self.spec),
+        default=lambda x: 'not_serializable('
+        '%s)' % str(x))

Review comment:
       I think the spec is probably not that meaningful as display data so I removed it altogether. If user reports that they need to display additional metadata we could then give them an option to pass a dict to the constructor.




----------------------------------------------------------------
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