MindsDB 25.4.4.0__py3-none-any.whl → 25.5.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of MindsDB might be problematic. Click here for more details.
- mindsdb/__about__.py +1 -1
- mindsdb/__main__.py +107 -125
- mindsdb/api/executor/command_executor.py +14 -3
- mindsdb/api/executor/datahub/datanodes/information_schema_datanode.py +8 -0
- mindsdb/api/executor/datahub/datanodes/mindsdb_tables.py +2 -1
- mindsdb/api/executor/datahub/datanodes/system_tables.py +10 -13
- mindsdb/api/executor/planner/query_plan.py +1 -0
- mindsdb/api/executor/planner/query_planner.py +9 -1
- mindsdb/api/executor/sql_query/sql_query.py +24 -8
- mindsdb/api/executor/sql_query/steps/apply_predictor_step.py +21 -3
- mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +3 -1
- mindsdb/api/http/initialize.py +20 -3
- mindsdb/api/http/namespaces/analysis.py +14 -1
- mindsdb/api/http/namespaces/config.py +19 -11
- mindsdb/api/http/namespaces/tree.py +1 -1
- mindsdb/api/http/start.py +7 -2
- mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +4 -8
- mindsdb/api/mysql/mysql_proxy/utilities/exceptions.py +0 -4
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message_formats.py +2 -2
- mindsdb/integrations/handlers/bigquery_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/chromadb_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/gmail_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/google_analytics_handler/requirements.txt +2 -1
- mindsdb/integrations/handlers/google_books_handler/requirements.txt +1 -1
- mindsdb/integrations/handlers/google_calendar_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/google_content_shopping_handler/requirements.txt +1 -1
- mindsdb/integrations/handlers/google_fit_handler/requirements.txt +2 -0
- mindsdb/integrations/handlers/google_search_handler/requirements.txt +1 -1
- mindsdb/integrations/handlers/jira_handler/jira_handler.archived.py +75 -0
- mindsdb/integrations/handlers/jira_handler/jira_handler.py +113 -38
- mindsdb/integrations/handlers/jira_handler/jira_tables.py +229 -0
- mindsdb/integrations/handlers/jira_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/lightfm_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/lightwood_handler/lightwood_handler.py +0 -2
- mindsdb/integrations/handlers/lightwood_handler/requirements.txt +4 -4
- mindsdb/integrations/handlers/lindorm_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/ms_one_drive_handler/requirements.txt +2 -0
- mindsdb/integrations/handlers/ms_teams_handler/requirements.txt +3 -1
- mindsdb/integrations/handlers/openai_handler/helpers.py +3 -5
- mindsdb/integrations/handlers/openai_handler/openai_handler.py +25 -12
- mindsdb/integrations/handlers/snowflake_handler/requirements.txt +1 -1
- mindsdb/integrations/handlers/togetherai_handler/__about__.py +9 -0
- mindsdb/integrations/handlers/togetherai_handler/__init__.py +20 -0
- mindsdb/integrations/handlers/togetherai_handler/creation_args.py +14 -0
- mindsdb/integrations/handlers/togetherai_handler/icon.svg +15 -0
- mindsdb/integrations/handlers/togetherai_handler/model_using_args.py +5 -0
- mindsdb/integrations/handlers/togetherai_handler/requirements.txt +2 -0
- mindsdb/integrations/handlers/togetherai_handler/settings.py +33 -0
- mindsdb/integrations/handlers/togetherai_handler/togetherai_handler.py +234 -0
- mindsdb/integrations/handlers/vertex_handler/requirements.txt +1 -0
- mindsdb/integrations/handlers/youtube_handler/requirements.txt +1 -0
- mindsdb/integrations/utilities/files/file_reader.py +5 -2
- mindsdb/integrations/utilities/handler_utils.py +4 -0
- mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +360 -0
- mindsdb/integrations/utilities/rag/rerankers/reranker_compressor.py +6 -346
- mindsdb/interfaces/agents/constants.py +14 -2
- mindsdb/interfaces/agents/langchain_agent.py +2 -4
- mindsdb/interfaces/database/projects.py +1 -7
- mindsdb/interfaces/functions/controller.py +14 -16
- mindsdb/interfaces/functions/to_markdown.py +9 -124
- mindsdb/interfaces/knowledge_base/controller.py +109 -92
- mindsdb/interfaces/knowledge_base/preprocessing/document_preprocessor.py +28 -5
- mindsdb/interfaces/knowledge_base/utils.py +10 -15
- mindsdb/interfaces/model/model_controller.py +0 -2
- mindsdb/interfaces/query_context/context_controller.py +55 -15
- mindsdb/interfaces/query_context/query_task.py +19 -0
- mindsdb/interfaces/skills/sql_agent.py +33 -11
- mindsdb/interfaces/storage/db.py +2 -2
- mindsdb/interfaces/tasks/task_monitor.py +5 -1
- mindsdb/interfaces/tasks/task_thread.py +6 -0
- mindsdb/migrations/migrate.py +0 -2
- mindsdb/migrations/versions/2025-04-22_53502b6d63bf_query_database.py +27 -0
- mindsdb/utilities/config.py +15 -3
- mindsdb/utilities/context.py +2 -1
- mindsdb/utilities/functions.py +0 -36
- mindsdb/utilities/langfuse.py +19 -10
- mindsdb/utilities/otel/__init__.py +9 -193
- mindsdb/utilities/otel/metric_handlers/__init__.py +5 -1
- mindsdb/utilities/otel/prepare.py +198 -0
- mindsdb/utilities/sql.py +83 -0
- {mindsdb-25.4.4.0.dist-info → mindsdb-25.5.3.0.dist-info}/METADATA +662 -592
- {mindsdb-25.4.4.0.dist-info → mindsdb-25.5.3.0.dist-info}/RECORD +85 -69
- {mindsdb-25.4.4.0.dist-info → mindsdb-25.5.3.0.dist-info}/WHEEL +1 -1
- mindsdb/api/mysql/mysql_proxy/classes/sql_statement_parser.py +0 -151
- {mindsdb-25.4.4.0.dist-info → mindsdb-25.5.3.0.dist-info}/licenses/LICENSE +0 -0
- {mindsdb-25.4.4.0.dist-info → mindsdb-25.5.3.0.dist-info}/top_level.txt +0 -0
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
|
|
3
|
-
from pyparsing import (
|
|
4
|
-
CaselessKeyword,
|
|
5
|
-
originalTextFor,
|
|
6
|
-
ParseException,
|
|
7
|
-
ParserElement,
|
|
8
|
-
QuotedString,
|
|
9
|
-
ZeroOrMore,
|
|
10
|
-
nestedExpr,
|
|
11
|
-
restOfLine,
|
|
12
|
-
StringEnd,
|
|
13
|
-
Literal,
|
|
14
|
-
SkipTo
|
|
15
|
-
)
|
|
16
|
-
from mindsdb.api.mysql.mysql_proxy.utilities import exceptions as exc
|
|
17
|
-
|
|
18
|
-
RE_INT = re.compile(r'^[-+]?([1-9]\d*|0)$')
|
|
19
|
-
RE_FLOAT = re.compile(r'^[-+]?([1-9]\d*\.\d*|0\.|0\.\d*)$')
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class SqlStatementParser():
|
|
23
|
-
def __init__(self, text):
|
|
24
|
-
self._original_sql = text
|
|
25
|
-
self._sql = SqlStatementParser.clear_sql(text)
|
|
26
|
-
self._keyword = SqlStatementParser.get_keyword(self._sql)
|
|
27
|
-
self._struct = None
|
|
28
|
-
|
|
29
|
-
@property
|
|
30
|
-
def keyword(self):
|
|
31
|
-
return self._keyword
|
|
32
|
-
|
|
33
|
-
@property
|
|
34
|
-
def sql(self):
|
|
35
|
-
return self._sql
|
|
36
|
-
|
|
37
|
-
@property
|
|
38
|
-
def struct(self):
|
|
39
|
-
return self._struct
|
|
40
|
-
|
|
41
|
-
@staticmethod
|
|
42
|
-
def clear_sql(sql: str) -> str:
|
|
43
|
-
''' remove comments from sql
|
|
44
|
-
TODO current implementation is not remove /**/ from mid of string:
|
|
45
|
-
select a, /*comment*/ from b
|
|
46
|
-
'''
|
|
47
|
-
# remove /*comment*/
|
|
48
|
-
ParserElement.defaultWhitespaceChars = (" \t")
|
|
49
|
-
comment = nestedExpr('/*', '*/').suppress()
|
|
50
|
-
starting = ZeroOrMore(comment.suppress())
|
|
51
|
-
ending = ZeroOrMore(comment | ';').suppress() + StringEnd()
|
|
52
|
-
expr = starting + SkipTo(ending) + ending
|
|
53
|
-
sql = expr.transformString(sql)
|
|
54
|
-
|
|
55
|
-
# remove -- and # comments
|
|
56
|
-
oracleSqlComment = Literal("--") + restOfLine
|
|
57
|
-
mySqlComment = Literal("#") + restOfLine
|
|
58
|
-
|
|
59
|
-
expr = (
|
|
60
|
-
originalTextFor(QuotedString("'"))
|
|
61
|
-
| originalTextFor(QuotedString('"'))
|
|
62
|
-
| originalTextFor(QuotedString('`'))
|
|
63
|
-
| (oracleSqlComment | mySqlComment).suppress()
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
sql = expr.transformString(sql)
|
|
67
|
-
sql = sql.strip(' \n\t')
|
|
68
|
-
|
|
69
|
-
return sql
|
|
70
|
-
|
|
71
|
-
@staticmethod
|
|
72
|
-
def get_keyword(sql):
|
|
73
|
-
''' Return keyword of sql statement. Should be one of:
|
|
74
|
-
|
|
75
|
-
start (transaction)
|
|
76
|
-
set (autocommit, names etc)
|
|
77
|
-
use
|
|
78
|
-
show
|
|
79
|
-
delete
|
|
80
|
-
insert
|
|
81
|
-
update
|
|
82
|
-
alter
|
|
83
|
-
select
|
|
84
|
-
rollback
|
|
85
|
-
commit
|
|
86
|
-
explain
|
|
87
|
-
drop
|
|
88
|
-
retrain
|
|
89
|
-
describe
|
|
90
|
-
begin
|
|
91
|
-
|
|
92
|
-
create_predictor
|
|
93
|
-
create_table
|
|
94
|
-
create_datasource
|
|
95
|
-
create_database
|
|
96
|
-
'''
|
|
97
|
-
START, SET, USE, SHOW, DELETE, INSERT, UPDATE, ALTER, SELECT, ROLLBACK, COMMIT, EXPLAIN, CREATE, AI, TABLE, PREDICTOR, VIEW, DATASOURCE, DROP, RETRAIN, DESCRIBE, DATABASE, BEGIN = map(
|
|
98
|
-
CaselessKeyword,
|
|
99
|
-
"START SET USE SHOW DELETE INSERT UPDATE ALTER SELECT ROLLBACK COMMIT EXPLAIN CREATE AI TABLE PREDICTOR VIEW DATASOURCE DROP RETRAIN DESCRIBE DATABASE BEGIN".split()
|
|
100
|
-
)
|
|
101
|
-
CREATE_PREDICTOR = CREATE + PREDICTOR
|
|
102
|
-
CREATE_VIEW = CREATE + VIEW
|
|
103
|
-
CREATE_DATASOURCE = CREATE + DATASOURCE
|
|
104
|
-
CREATE_DATABASE = CREATE + DATABASE
|
|
105
|
-
CREATE_TABLE = CREATE + TABLE
|
|
106
|
-
|
|
107
|
-
expr = (
|
|
108
|
-
START | SET | USE
|
|
109
|
-
| SHOW | DELETE | INSERT
|
|
110
|
-
| UPDATE | ALTER | SELECT
|
|
111
|
-
| ROLLBACK | COMMIT | EXPLAIN
|
|
112
|
-
| CREATE_PREDICTOR
|
|
113
|
-
| CREATE_VIEW | DROP | RETRAIN
|
|
114
|
-
| CREATE_DATASOURCE | DESCRIBE
|
|
115
|
-
| CREATE_DATABASE | CREATE_TABLE | BEGIN
|
|
116
|
-
)('keyword')
|
|
117
|
-
|
|
118
|
-
r = expr.parseString(sql)
|
|
119
|
-
|
|
120
|
-
keyword = '_'.join(r.get('keyword', [])).lower()
|
|
121
|
-
|
|
122
|
-
if keyword == 0:
|
|
123
|
-
raise exc.ErSqlSyntaxError('Cant get keyword from statement')
|
|
124
|
-
|
|
125
|
-
return keyword
|
|
126
|
-
|
|
127
|
-
def ends_with(self, text):
|
|
128
|
-
''' Check if sql ends with 'text'. Not case sensitive.
|
|
129
|
-
'''
|
|
130
|
-
test_sql = ' '.join(self._sql.split()).lower()
|
|
131
|
-
return test_sql.endswith(text.lower())
|
|
132
|
-
|
|
133
|
-
def cut_from_tail(self, text):
|
|
134
|
-
''' Removes 'text' from end of sql. Not case sensitive.
|
|
135
|
-
'''
|
|
136
|
-
text_arr = text.split(' ')
|
|
137
|
-
|
|
138
|
-
ending = CaselessKeyword(text_arr[0])
|
|
139
|
-
for x in text_arr[1:]:
|
|
140
|
-
ending = ending + CaselessKeyword(x)
|
|
141
|
-
ending = ending + StringEnd()
|
|
142
|
-
|
|
143
|
-
expr = (originalTextFor(SkipTo(ending)))('original') + (originalTextFor(ending))('ending')
|
|
144
|
-
|
|
145
|
-
try:
|
|
146
|
-
r = expr.parseString(self._sql)
|
|
147
|
-
except ParseException:
|
|
148
|
-
return False
|
|
149
|
-
|
|
150
|
-
self._sql = r.asDict()['original'].strip()
|
|
151
|
-
return True
|
|
File without changes
|
|
File without changes
|