MindsDB 25.5.4.1__py3-none-any.whl → 25.6.2.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/api/a2a/agent.py +28 -25
- mindsdb/api/a2a/common/server/server.py +32 -26
- mindsdb/api/a2a/run_a2a.py +1 -1
- mindsdb/api/executor/command_executor.py +69 -14
- mindsdb/api/executor/datahub/datanodes/integration_datanode.py +49 -65
- mindsdb/api/executor/datahub/datanodes/project_datanode.py +29 -48
- mindsdb/api/executor/datahub/datanodes/system_tables.py +35 -61
- mindsdb/api/executor/planner/plan_join.py +67 -77
- mindsdb/api/executor/planner/query_planner.py +176 -155
- mindsdb/api/executor/planner/steps.py +37 -12
- mindsdb/api/executor/sql_query/result_set.py +45 -64
- mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +14 -18
- mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +17 -18
- mindsdb/api/executor/sql_query/steps/insert_step.py +13 -33
- mindsdb/api/executor/sql_query/steps/subselect_step.py +43 -35
- mindsdb/api/executor/utilities/sql.py +42 -48
- mindsdb/api/http/namespaces/config.py +1 -1
- mindsdb/api/http/namespaces/file.py +14 -23
- mindsdb/api/mysql/mysql_proxy/data_types/mysql_datum.py +12 -28
- mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/binary_resultset_row_package.py +59 -50
- mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/resultset_row_package.py +9 -8
- mindsdb/api/mysql/mysql_proxy/libs/constants/mysql.py +449 -461
- mindsdb/api/mysql/mysql_proxy/utilities/dump.py +87 -36
- mindsdb/integrations/handlers/file_handler/file_handler.py +15 -9
- mindsdb/integrations/handlers/file_handler/tests/test_file_handler.py +43 -24
- mindsdb/integrations/handlers/litellm_handler/litellm_handler.py +10 -3
- mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +26 -33
- mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +74 -51
- mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +305 -98
- mindsdb/integrations/handlers/salesforce_handler/salesforce_handler.py +53 -34
- mindsdb/integrations/handlers/salesforce_handler/salesforce_tables.py +136 -6
- mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +334 -83
- mindsdb/integrations/libs/api_handler.py +261 -57
- mindsdb/integrations/libs/base.py +100 -29
- mindsdb/integrations/utilities/files/file_reader.py +99 -73
- mindsdb/integrations/utilities/handler_utils.py +23 -8
- mindsdb/integrations/utilities/sql_utils.py +35 -40
- mindsdb/interfaces/agents/agents_controller.py +196 -192
- mindsdb/interfaces/agents/constants.py +7 -1
- mindsdb/interfaces/agents/langchain_agent.py +42 -11
- mindsdb/interfaces/agents/mcp_client_agent.py +29 -21
- mindsdb/interfaces/data_catalog/__init__.py +0 -0
- mindsdb/interfaces/data_catalog/base_data_catalog.py +54 -0
- mindsdb/interfaces/data_catalog/data_catalog_loader.py +359 -0
- mindsdb/interfaces/data_catalog/data_catalog_reader.py +34 -0
- mindsdb/interfaces/database/database.py +81 -57
- mindsdb/interfaces/database/integrations.py +220 -234
- mindsdb/interfaces/database/log.py +72 -104
- mindsdb/interfaces/database/projects.py +156 -193
- mindsdb/interfaces/file/file_controller.py +21 -65
- mindsdb/interfaces/knowledge_base/controller.py +63 -10
- mindsdb/interfaces/knowledge_base/evaluate.py +519 -0
- mindsdb/interfaces/knowledge_base/llm_client.py +75 -0
- mindsdb/interfaces/skills/custom/text2sql/mindsdb_kb_tools.py +83 -43
- mindsdb/interfaces/skills/skills_controller.py +54 -36
- mindsdb/interfaces/skills/sql_agent.py +109 -86
- mindsdb/interfaces/storage/db.py +223 -79
- mindsdb/migrations/versions/2025-05-28_a44643042fe8_added_data_catalog_tables.py +118 -0
- mindsdb/migrations/versions/2025-06-09_608e376c19a7_updated_data_catalog_data_types.py +58 -0
- mindsdb/utilities/config.py +9 -2
- mindsdb/utilities/log.py +35 -26
- mindsdb/utilities/ml_task_queue/task.py +19 -22
- mindsdb/utilities/render/sqlalchemy_render.py +129 -181
- mindsdb/utilities/starters.py +49 -1
- {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/METADATA +268 -268
- {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/RECORD +70 -62
- {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/WHEEL +0 -0
- {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/licenses/LICENSE +0 -0
- {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/top_level.txt +0 -0
|
@@ -35,7 +35,7 @@ class LogTable(ABC):
|
|
|
35
35
|
name: str
|
|
36
36
|
deletable: bool = False
|
|
37
37
|
visible: bool = True
|
|
38
|
-
kind: str =
|
|
38
|
+
kind: str = "table"
|
|
39
39
|
|
|
40
40
|
@staticmethod
|
|
41
41
|
@abstractmethod
|
|
@@ -59,142 +59,113 @@ class LogTable(ABC):
|
|
|
59
59
|
BinaryOperation: statement that can be used for 'safe' comparison
|
|
60
60
|
"""
|
|
61
61
|
return BinaryOperation(
|
|
62
|
-
op=
|
|
62
|
+
op="=",
|
|
63
63
|
args=(
|
|
64
|
-
Function(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Identifier(f'{table_a}.company_id'),
|
|
68
|
-
0
|
|
69
|
-
)
|
|
70
|
-
),
|
|
71
|
-
Function(
|
|
72
|
-
op='coalesce',
|
|
73
|
-
args=(
|
|
74
|
-
Identifier(f'{table_b}.company_id'),
|
|
75
|
-
0
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
)
|
|
64
|
+
Function(op="coalesce", args=(Identifier(f"{table_a}.company_id"), 0)),
|
|
65
|
+
Function(op="coalesce", args=(Identifier(f"{table_b}.company_id"), 0)),
|
|
66
|
+
),
|
|
79
67
|
)
|
|
80
68
|
|
|
81
69
|
|
|
82
70
|
class LLMLogTable(LogTable):
|
|
83
|
-
name =
|
|
71
|
+
name = "llm_log"
|
|
84
72
|
|
|
85
73
|
columns = [
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
"API_KEY",
|
|
75
|
+
"MODEL_NAME",
|
|
76
|
+
"INPUT",
|
|
77
|
+
"OUTPUT",
|
|
78
|
+
"START_TIME",
|
|
79
|
+
"END_TIME",
|
|
80
|
+
"PROMPT_TOKENS",
|
|
81
|
+
"COMPLETION_TOKENS",
|
|
82
|
+
"TOTAL_TOKENS",
|
|
83
|
+
"SUCCESS",
|
|
88
84
|
]
|
|
89
85
|
|
|
90
|
-
types_map = {
|
|
91
|
-
'SUCCESS': 'boolean',
|
|
92
|
-
'START_TIME': 'datetime64[ns]',
|
|
93
|
-
'END_TIME': 'datetime64[ns]'
|
|
94
|
-
}
|
|
86
|
+
types_map = {"SUCCESS": "boolean", "START_TIME": "datetime64[ns]", "END_TIME": "datetime64[ns]"}
|
|
95
87
|
|
|
96
88
|
@staticmethod
|
|
97
89
|
def _get_base_subquery() -> Select:
|
|
98
90
|
query = Select(
|
|
99
91
|
targets=[
|
|
100
|
-
Identifier(
|
|
101
|
-
Identifier(
|
|
102
|
-
Identifier(
|
|
103
|
-
Identifier(
|
|
104
|
-
Identifier(
|
|
105
|
-
Identifier(
|
|
106
|
-
Identifier(
|
|
107
|
-
Identifier(
|
|
108
|
-
Identifier(
|
|
109
|
-
Identifier(
|
|
92
|
+
Identifier("llm_log.api_key", alias=Identifier("api_key")),
|
|
93
|
+
Identifier("predictor.name", alias=Identifier("model_name")),
|
|
94
|
+
Identifier("llm_log.input", alias=Identifier("input")),
|
|
95
|
+
Identifier("llm_log.output", alias=Identifier("output")),
|
|
96
|
+
Identifier("llm_log.start_time", alias=Identifier("start_time")),
|
|
97
|
+
Identifier("llm_log.end_time", alias=Identifier("end_time")),
|
|
98
|
+
Identifier("llm_log.prompt_tokens", alias=Identifier("prompt_tokens")),
|
|
99
|
+
Identifier("llm_log.completion_tokens", alias=Identifier("completion_tokens")),
|
|
100
|
+
Identifier("llm_log.total_tokens", alias=Identifier("total_tokens")),
|
|
101
|
+
Identifier("llm_log.success", alias=Identifier("success")),
|
|
110
102
|
],
|
|
111
103
|
from_table=Join(
|
|
112
|
-
left=Identifier(
|
|
113
|
-
right=Identifier(
|
|
104
|
+
left=Identifier("llm_log"),
|
|
105
|
+
right=Identifier("predictor"),
|
|
114
106
|
join_type=JoinType.LEFT_JOIN,
|
|
115
107
|
condition=BinaryOperation(
|
|
116
|
-
op=
|
|
108
|
+
op="and",
|
|
117
109
|
args=(
|
|
118
|
-
LLMLogTable.company_id_comparison(
|
|
119
|
-
BinaryOperation(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
Identifier('llm_log.model_id'),
|
|
123
|
-
Identifier('predictor.id')
|
|
124
|
-
)
|
|
125
|
-
)
|
|
126
|
-
)
|
|
127
|
-
)
|
|
110
|
+
LLMLogTable.company_id_comparison("llm_log", "predictor"),
|
|
111
|
+
BinaryOperation(op="=", args=(Identifier("llm_log.model_id"), Identifier("predictor.id"))),
|
|
112
|
+
),
|
|
113
|
+
),
|
|
128
114
|
),
|
|
129
115
|
where=BinaryOperation(
|
|
130
|
-
op=
|
|
131
|
-
args=(Identifier(
|
|
116
|
+
op="is" if ctx.company_id is None else "=",
|
|
117
|
+
args=(Identifier("llm_log.company_id"), Constant(ctx.company_id)),
|
|
132
118
|
),
|
|
133
|
-
alias=Identifier(
|
|
119
|
+
alias=Identifier("llm_log"),
|
|
134
120
|
)
|
|
135
121
|
return query
|
|
136
122
|
|
|
137
123
|
|
|
138
124
|
class JobsHistoryTable(LogTable):
|
|
139
|
-
name =
|
|
125
|
+
name = "jobs_history"
|
|
140
126
|
|
|
141
|
-
columns = [
|
|
142
|
-
types_map = {
|
|
143
|
-
'RUN_START': 'datetime64[ns]',
|
|
144
|
-
'RUN_END': 'datetime64[ns]'
|
|
145
|
-
}
|
|
127
|
+
columns = ["NAME", "PROJECT", "RUN_START", "RUN_END", "ERROR", "QUERY"]
|
|
128
|
+
types_map = {"RUN_START": "datetime64[ns]", "RUN_END": "datetime64[ns]"}
|
|
146
129
|
|
|
147
130
|
@staticmethod
|
|
148
131
|
def _get_base_subquery() -> Select:
|
|
149
132
|
query = Select(
|
|
150
133
|
targets=[
|
|
151
|
-
Identifier(
|
|
152
|
-
Identifier(
|
|
153
|
-
Identifier(
|
|
154
|
-
Identifier(
|
|
155
|
-
Identifier(
|
|
156
|
-
Identifier(
|
|
134
|
+
Identifier("jobs.name", alias=Identifier("name")),
|
|
135
|
+
Identifier("project.name", alias=Identifier("project")),
|
|
136
|
+
Identifier("jobs_history.start_at", alias=Identifier("run_start")),
|
|
137
|
+
Identifier("jobs_history.end_at", alias=Identifier("run_end")),
|
|
138
|
+
Identifier("jobs_history.error", alias=Identifier("error")),
|
|
139
|
+
Identifier("jobs_history.query_str", alias=Identifier("query")),
|
|
157
140
|
],
|
|
158
141
|
from_table=Join(
|
|
159
142
|
left=Join(
|
|
160
|
-
left=Identifier(
|
|
161
|
-
right=Identifier(
|
|
143
|
+
left=Identifier("jobs_history"),
|
|
144
|
+
right=Identifier("jobs"),
|
|
162
145
|
join_type=JoinType.LEFT_JOIN,
|
|
163
146
|
condition=BinaryOperation(
|
|
164
|
-
op=
|
|
147
|
+
op="and",
|
|
165
148
|
args=(
|
|
166
|
-
LLMLogTable.company_id_comparison(
|
|
167
|
-
BinaryOperation(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
Identifier('jobs_history.job_id'),
|
|
171
|
-
Identifier('jobs.id')
|
|
172
|
-
)
|
|
173
|
-
)
|
|
174
|
-
)
|
|
175
|
-
)
|
|
149
|
+
LLMLogTable.company_id_comparison("jobs_history", "jobs"),
|
|
150
|
+
BinaryOperation(op="=", args=(Identifier("jobs_history.job_id"), Identifier("jobs.id"))),
|
|
151
|
+
),
|
|
152
|
+
),
|
|
176
153
|
),
|
|
177
|
-
right=Identifier(
|
|
154
|
+
right=Identifier("project"),
|
|
178
155
|
join_type=JoinType.LEFT_JOIN,
|
|
179
156
|
condition=BinaryOperation(
|
|
180
|
-
op=
|
|
157
|
+
op="and",
|
|
181
158
|
args=(
|
|
182
|
-
LLMLogTable.company_id_comparison(
|
|
183
|
-
BinaryOperation(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
Identifier('project.id'),
|
|
187
|
-
Identifier('jobs.project_id')
|
|
188
|
-
)
|
|
189
|
-
)
|
|
190
|
-
)
|
|
191
|
-
)
|
|
159
|
+
LLMLogTable.company_id_comparison("project", "jobs"),
|
|
160
|
+
BinaryOperation(op="=", args=(Identifier("project.id"), Identifier("jobs.project_id"))),
|
|
161
|
+
),
|
|
162
|
+
),
|
|
192
163
|
),
|
|
193
164
|
where=BinaryOperation(
|
|
194
|
-
op=
|
|
195
|
-
args=(Identifier(
|
|
165
|
+
op="is" if ctx.company_id is None else "=",
|
|
166
|
+
args=(Identifier("jobs_history.company_id"), Constant(ctx.company_id)),
|
|
196
167
|
),
|
|
197
|
-
alias=Identifier(
|
|
168
|
+
alias=Identifier("jobs_history"),
|
|
198
169
|
)
|
|
199
170
|
return query
|
|
200
171
|
|
|
@@ -202,8 +173,8 @@ class JobsHistoryTable(LogTable):
|
|
|
202
173
|
class LogDBController:
|
|
203
174
|
def __init__(self):
|
|
204
175
|
self._tables = OrderedDict()
|
|
205
|
-
self._tables[
|
|
206
|
-
self._tables[
|
|
176
|
+
self._tables["llm_log"] = LLMLogTable
|
|
177
|
+
self._tables["jobs_history"] = JobsHistoryTable
|
|
207
178
|
|
|
208
179
|
def get_list(self) -> List[LogTable]:
|
|
209
180
|
return list(self._tables.values())
|
|
@@ -212,11 +183,14 @@ class LogDBController:
|
|
|
212
183
|
try:
|
|
213
184
|
return self._tables[name]
|
|
214
185
|
except KeyError:
|
|
215
|
-
raise EntityNotExistsError(f
|
|
186
|
+
raise EntityNotExistsError(f"Table log.{name} does not exists")
|
|
216
187
|
|
|
217
188
|
def get_tables(self) -> OrderedDict:
|
|
218
189
|
return self._tables
|
|
219
190
|
|
|
191
|
+
def get_tree_tables(self) -> OrderedDict:
|
|
192
|
+
return self._tables
|
|
193
|
+
|
|
220
194
|
def get_tables_rows(self) -> List[TablesRow]:
|
|
221
195
|
return [
|
|
222
196
|
TablesRow(TABLE_TYPE=TABLES_ROW_TYPE.SYSTEM_VIEW, TABLE_NAME=table_name)
|
|
@@ -237,7 +211,7 @@ class LogDBController:
|
|
|
237
211
|
if len(tables) != 1:
|
|
238
212
|
raise Exception("Only one table may be in query to log database")
|
|
239
213
|
table = tables[0]
|
|
240
|
-
if table[0] is not None and table[0].lower() !=
|
|
214
|
+
if table[0] is not None and table[0].lower() != "log":
|
|
241
215
|
raise Exception("This is not a query to the log database")
|
|
242
216
|
if table[1].lower() not in self._tables.keys():
|
|
243
217
|
raise Exception(f"There is no table '{table[1]}' in the log database")
|
|
@@ -273,7 +247,7 @@ class LogDBController:
|
|
|
273
247
|
|
|
274
248
|
render_engine = db.engine.name
|
|
275
249
|
if render_engine == "postgresql":
|
|
276
|
-
|
|
250
|
+
"postgres"
|
|
277
251
|
render = SqlalchemyRender(render_engine)
|
|
278
252
|
query_str = render.get_string(query, with_failback=False)
|
|
279
253
|
df = pd.read_sql_query(query_str, db.engine)
|
|
@@ -285,12 +259,6 @@ class LogDBController:
|
|
|
285
259
|
df[df_column_name] = df[df_column_name].astype(column_type)
|
|
286
260
|
# endregion
|
|
287
261
|
|
|
288
|
-
columns_info = [{
|
|
289
|
-
'name': k,
|
|
290
|
-
'type': v
|
|
291
|
-
} for k, v in df.dtypes.items()]
|
|
262
|
+
columns_info = [{"name": k, "type": v} for k, v in df.dtypes.items()]
|
|
292
263
|
|
|
293
|
-
return DataHubResponse(
|
|
294
|
-
data_frame=df,
|
|
295
|
-
columns=columns_info
|
|
296
|
-
)
|
|
264
|
+
return DataHubResponse(data_frame=df, columns=columns_info)
|