-
Notifications
You must be signed in to change notification settings - Fork 2
add ability to directly connect to mongo with pymongo.MongoClient #54
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
base: main
Are you sure you want to change the base?
Conversation
…n from pymongo. useful when instantiating a linkml_store.Client class with an existing mongodb connection, e.g. from an external job like Jenkins or Dagster
PR Change SummaryAdded support for directly connecting to MongoDB using existing MongoClient instances, enhancing the functionality of the linkml_store.Client class.
Modified Files
How can I customize these reviews?Check out the Hyperlint AI Reviewer docs for more information on how to customize the review. If you just want to ignore it on this PR, you can add the Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add |
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for attaching existing pymongo.MongoClient
instances directly to a Client
, alongside existing connection‐string workflows.
- Introduces
attach_native_connection
andattach_mongodb_client
methods inClient
- Updates
MongoDBDatabase
to accept amongo_client
and override database name - Adds tests and documentation for direct MongoClient usage
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/test_api/test_mongodb_client.py | New tests for attach_mongodb_client and attach_native_connection |
src/linkml_store/api/stores/mongodb/mongodb_database.py | Extended __init__ to accept mongo_client and db_name |
src/linkml_store/api/client.py | Added attach_native_connection and attach_mongodb_client |
docs/how-to/Use-MongoDB.ipynb | Tutorial updated with existing MongoClient examples |
README.md | Added feature note about direct MongoClient support |
Comments suppressed due to low confidence (4)
tests/test_api/test_mongodb_client.py:27
- [nitpick] Remove the duplicated
# Setup
comment on this line to avoid confusion and keep the setup section concise.
# # Setup
docs/how-to/Use-MongoDB.ipynb:54
- Notebook cells expect
source
as a list of strings, not a single string. Wrap each line (including newlines) as elements in an array to conform with the IPython notebook spec.
"source": "Next we'll attach to a MongoDB instance..."
src/linkml_store/api/stores/mongodb/mongodb_database.py:51
- Indentation here is incorrect and will cause a SyntaxError. Align this
if handle is None:
with the other statements in theif mongo_client is not None:
block (remove the extra spaces).
if handle is None:
src/linkml_store/api/client.py:282
- The code uses
importlib.import_module
butimportlib
is not imported. Addimport importlib
at the top of the file.
module = importlib.import_module(module_path)
useful when instantiating a linkml_store.Client class with an existing mongodb connection, e.g. from an external job like Jenkins or Dagster
fixes #55