feat(taps): add optional sanitization for JSON-serializable documents#49
Open
mporracindie wants to merge 2 commits intoMeltanoLabs:mainfrom
Open
feat(taps): add optional sanitization for JSON-serializable documents#49mporracindie wants to merge 2 commits intoMeltanoLabs:mainfrom
mporracindie wants to merge 2 commits intoMeltanoLabs:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new feature for sanitizing MongoDB documents to ensure JSON-serializability, along with associated updates to the codebase. The key changes include adding a
sanitize_documentsconfiguration option, implementing a utility function for document sanitization, and updating the data processing logic to use this feature when enabled.New Feature: Document Sanitization
README.md: Updated documentation to include the newsanitize_documentsconfiguration option, detailing its purpose and behavior.tap_mongodb/tap.py: Added thesanitize_documentsconfiguration option to the tap's schema, with a default value ofFalse.tap_mongodb/utils.py: Introduced thesanitize_docutility function, which converts MongoDB-specific types (e.g.,ObjectId,UUID,datetime,Binary) to JSON-serializable equivalents.Code Updates for Sanitization Integration
tap_mongodb/streams.py: Modified theget_recordsmethod to apply thesanitize_docfunction to documents when thesanitize_documentsconfiguration is enabled. This ensures that all extracted data is JSON-compatible. [1] [2]tap_mongodb/streams.py: Imported thesanitize_docfunction to enable its use in theget_recordsmethod.