Skip to content

Conversation

@ea-rus
Copy link
Collaborator

@ea-rus ea-rus commented Oct 14, 2025

  1. Implemented command to update knowledge base

Example:

ALTER KNOWLEDGE_BASE my_kb
            USING
                reranking_model={'provider': 'openai'},
                embedding_model={'api_key': '123'}
  1. Removed unusable yet parser option: 'create kb from select'. It makes parser lightweight a little

@github-actions
Copy link

github-actions bot commented Oct 14, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
mindsdb_sql_parser
   __about__.py10100%1–10
   __init__.py1192282%44, 48, 53, 98, 115, 139–158, 165–166
   lexer.py2832193%373, 375, 377, 389, 391, 393, 399–417
   logger.py19479%14, 17, 23, 26
   parser.py11143097%129, 133, 301, 326, 432, 619, 636, 660–661, 882, 936, 1013, 1114, 1168, 1178, 1247, 1258, 1341, 1417, 1456, 1492, 1688–1689, 1864–1865, 2041, 2049, 2102–2105
   utils.py46491%73–79
mindsdb_sql_parser/ast
   base.py36586%13, 28, 31, 46, 51
   create.py82989%7–8, 23–31, 95
   drop.py52296%10, 13
   insert.py63494%39–41, 46
   show.py48198%18
   update.py53591%40–42, 75–76
mindsdb_sql_parser/ast/mindsdb
   knowledge_base.py118397%79, 118, 128
mindsdb_sql_parser/ast/select
   case.py37197%22
   constant.py36197%23
   data.py11464%10–12, 15, 19
   identifier.py831187%56, 104–112, 122
   native_query.py13192%25
   operation.py139497%57, 66, 178, 202
   parameter.py15287%17, 20
   select.py109397%160–165
   star.py12283%8–9
TOTAL342514996% 

Tests Skipped Failures Errors Time
312 0 💤 0 ❌ 0 🔥 13.625s ⏱️

@entelligence-ai-pr-reviews
Copy link

🔒 Entelligence AI Vulnerability Scanner

No security vulnerabilities found!

Your code passed our comprehensive security analysis.

📊 Files Analyzed: 3 files


@entelligence-ai-pr-reviews
Copy link

Review Summary

🏷️ Draft Comments (1)

Skipped posting 1 draft comments that were valid but scored below your review threshold (>=13/15). Feel free to update them here.

mindsdb_sql_parser/parser.py (1)

146-158: ALTER KNOWLEDGE_BASE grammar does not support optional USING clause, so ALTER KNOWLEDGE_BASE my_kb (without USING) will fail to parse, violating SQL contract for optional clauses.

📊 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_sql_parser/parser.py, lines 146-158, the `alter_kb` parser rule only allows `ALTER KNOWLEDGE_BASE ... USING ...` and does not support the clause without `USING`. Update the grammar to also allow `ALTER KNOWLEDGE_BASE identifier` (without `USING`). Add the rule `'ALTER KNOWLEDGE_BASE identifier'` to the `@_` decorator for `alter_kb` so that both forms are accepted.

@ea-rus ea-rus requested a review from StpMax October 14, 2025 09:43
@ea-rus ea-rus changed the title Alter knowledge base command Alter knowledge base syntax Oct 14, 2025
self.params = params
def to_tree(self, *args, level=0, **kwargs):
ind = indent(level)
out_str = f"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to split it to multi-line, or use dedent

@ea-rus ea-rus merged commit 5885d02 into main Oct 14, 2025
14 checks passed
@ea-rus ea-rus deleted the alter-kb branch October 14, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants