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 20:22:08 UTC

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

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



##########
File path: sdks/python/apache_beam/io/mongodbio.py
##########
@@ -264,9 +264,11 @@ 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')

Review comment:
       What's usually not serializable? non-JSON Python objects? Perhaps you can try `lambda x: 'not serializable(%s)' % str(x)`?

##########
File path: sdks/python/apache_beam/io/mongodbio.py
##########
@@ -264,9 +264,11 @@ 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')

Review comment:
       (This is not required. Only up to you. Would it help if we add a unit test?)




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