pabloem commented on a change in pull request #14237:
URL: https://github.com/apache/beam/pull/14237#discussion_r594665257
##########
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:
one more concern: the spec may have the password (although we try to
remove it) - so I wonder if we should avoid calling str on the spec?
Or we leave it up to the user to:
1) Provide a `dict` where the password is protected, or
2) implement a `__str__` method that does not display the password.
Thoughts?
----------------------------------------------------------------
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:
[email protected]