Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sc-29393] MongoDB crawler ignore system collections #1010

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metaphor/mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ infer_schema_sample_size: <int> # Number of documents to sample in a collection
excluded_databases: # Databases to ignore. By default the databases "admin", "config", "local", "system" are excluded.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@usefulalgorithm Should alwsys exculde these as well.

- db1
- db2
excluded_collections: # Collections to ignore.
excluded_collections: # Extra collections to ignore. Note that the system specific collections (`system.views`, `system.profile`, etc.) are always ignored, see https://www.mongodb.com/docs/manual/reference/system-collections/#database-specific-collections for more details.
- coll1
- coll2
```
Expand Down
6 changes: 6 additions & 0 deletions metaphor/mongodb/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ class MongoDBExtractor(BaseExtractor):
def __init__(self, config: MongoDBConfig) -> None:
super().__init__(config)
self._sample_size = config.infer_schema_sample_size

self._excluded_collections = config.excluded_collections
# Always ignore these system collections
self._excluded_collections.update(
["system.buckets", "system.profile", "system.js", "system.views"]
)

self._excluded_databases = config.excluded_databases
self.client = config.get_client()
self._datasets: Dict[str, Dataset] = {}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "metaphor-connectors"
version = "0.14.126"
version = "0.14.127"
license = "Apache-2.0"
description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app."
authors = ["Metaphor <[email protected]>"]
Expand Down
Loading