Skip to content

Conversation

@MinuraPunchihewa
Copy link
Contributor

This PR adds the update operation (con.databases.update()) to the SDK.

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
mindsdb_sdk
   agents.py2176769%30, 106, 109, 112, 115, 123, 131, 151, 172, 183, 186, 190, 192, 194, 196, 198, 200, 202, 204, 206, 213, 277, 290, 301, 312, 315–319, 334, 343–347, 391, 399–400, 458, 466–467, 471, 501–509, 517–519, 521–522, 548–561, 573–574, 576
   databases.py57788%85–86, 148, 176, 187–193
   handlers.py39197%77
   jobs.py97793%40, 52, 80, 84, 146–149
   knowledge_bases.py1331886%70–73, 132–136, 160, 189, 196, 200–202, 206, 228–232, 242
   ml_engines.py42393%94, 126, 128
   models.py2101991%109, 140–141, 222, 231, 233, 303, 339, 348, 372, 397, 491, 499, 518, 534, 542, 567, 571, 584
   projects.py63198%160
   query.py13192%14
   server.py33294%88–89
   skills.py53983%43, 45, 49, 58–60, 76–80, 122
   tables.py1301588%140–142, 145, 165, 192, 203–204, 209, 224, 227, 321, 342–347, 356, 376
   tree.py321650%18–19, 24–28, 41–57
   views.py37295%105, 138
mindsdb_sdk/connectors
   rest_api.py2715679%19–29, 35–36, 51, 55, 58–59, 79–81, 87–89, 108, 111, 118–121, 144, 158–166, 187–188, 223–226, 240–241, 295–300, 304–316
mindsdb_sdk/utils
   agents.py50492%72, 79–81
   mind.py47470%1–128
   openai.py853065%37–40, 83–85, 107, 148–158, 215–216, 234–240, 258–276
   table_schema.py21210%1–54
TOTAL171132681% 

Tests Skipped Failures Errors Time
31 0 💤 0 ❌ 0 🔥 6.042s ⏱️

@entelligence-ai-pr-reviews
Copy link

🔒 Entelligence AI Vulnerability Scanner

No security vulnerabilities found!

Your code passed our comprehensive security analysis.

📊 Files Analyzed: 2 files


@entelligence-ai-pr-reviews
Copy link

Review Summary

🏷️ Draft Comments (2)

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.

@github-project-automation github-project-automation bot moved this from to review to approved in Tracking PRs Nov 5, 2025
@MinuraPunchihewa MinuraPunchihewa merged commit 6a7d0fe into main Nov 5, 2025
9 checks passed
@MinuraPunchihewa MinuraPunchihewa deleted the feature/update_database branch November 5, 2025 08:22
@github-project-automation github-project-automation bot moved this from approved to merged in Tracking PRs Nov 5, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: merged

Development

Successfully merging this pull request may close these issues.

3 participants