You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Skipped posting 2 draft comments that were valid but scored below your review threshold (>=13/15). Feel free to update them here.
mindsdb_sdk/databases.py (2)
178-193: update method in Databases does not check if the database exists before attempting to update, leading to a misleading success if the database does not exist.
📊 Impact Scores:
Production Impact: 4/5
Fix Specificity: 5/5
Urgency Impact: 3/5
Total Score: 12/15
🤖 AI Agent Prompt (Copy & Paste Ready):
In mindsdb_sdk/databases.py, lines 178-193, the `update` method does not check if the database exists before attempting to update it. This can result in a misleading success if the database does not exist. Please add a check at the start of the method to verify the database exists (using self._list_databases()), and raise an AttributeError if it does not, matching the behavior of the `get` method.
116-126: _list_databases fetches all databases and iterates through all rows on every call, causing O(n) overhead for each get, list, or update operation; this is inefficient for large numbers of databases.
📊 Impact Scores:
Production Impact: 2/5
Fix Specificity: 4/5
Urgency Impact: 2/5
Total Score: 8/15
🤖 AI Agent Prompt (Copy & Paste Ready):
Optimize the `_list_databases` method in `mindsdb_sdk/databases.py` (lines 116-126). Currently, it fetches and iterates through all databases on every call, causing O(n) overhead for each `get`, `list`, or `update` operation. Add a simple in-memory cache (e.g., `self._cached_databases`) to avoid repeated full scans, and invalidate the cache in `create`, `drop`, and `update` methods after changes.
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 freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
3 participants
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 PR adds the update operation (
con.databases.update()) to the SDK.