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
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* permission of MindsDB Inc
|
|
9
9
|
*******************************************************
|
|
10
10
|
"""
|
|
11
|
+
|
|
11
12
|
import datetime as dt
|
|
12
13
|
import struct
|
|
13
14
|
|
|
@@ -19,17 +20,17 @@ from mindsdb.api.mysql.mysql_proxy.libs.constants.mysql import TYPES
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class BinaryResultsetRowPacket(Packet):
|
|
22
|
-
|
|
23
|
+
"""
|
|
23
24
|
Implementation based on:
|
|
24
25
|
https://mariadb.com/kb/en/resultset-row/#binary-resultset-row
|
|
25
26
|
https://dev.mysql.com/doc/internals/en/null-bitmap.html
|
|
26
|
-
|
|
27
|
+
"""
|
|
27
28
|
|
|
28
29
|
def setup(self):
|
|
29
|
-
data = self._kwargs.get(
|
|
30
|
-
columns = self._kwargs.get(
|
|
30
|
+
data = self._kwargs.get("data", {})
|
|
31
|
+
columns = self._kwargs.get("columns", {})
|
|
31
32
|
|
|
32
|
-
self.value = [b
|
|
33
|
+
self.value = [b"\x00"]
|
|
33
34
|
|
|
34
35
|
# NOTE: according to mysql's doc offset=0 only for COM_STMT_EXECUTE, mariadb's doc does't mention that
|
|
35
36
|
# but in fact it looks like offset=2 everywhere
|
|
@@ -40,7 +41,7 @@ class BinaryResultsetRowPacket(Packet):
|
|
|
40
41
|
continue
|
|
41
42
|
byte_index = (i + offset) // 8
|
|
42
43
|
bit_index = (i + offset) % 8
|
|
43
|
-
nulls_bitmap[byte_index] |=
|
|
44
|
+
nulls_bitmap[byte_index] |= 1 << bit_index
|
|
44
45
|
self.value.append(bytes(nulls_bitmap))
|
|
45
46
|
|
|
46
47
|
for i, col in enumerate(columns):
|
|
@@ -51,27 +52,27 @@ class BinaryResultsetRowPacket(Packet):
|
|
|
51
52
|
|
|
52
53
|
enc = None
|
|
53
54
|
env_val = None
|
|
54
|
-
col_type = col[
|
|
55
|
+
col_type = col["type"]
|
|
55
56
|
if col_type == TYPES.MYSQL_TYPE_DOUBLE:
|
|
56
|
-
enc =
|
|
57
|
+
enc = "<d"
|
|
57
58
|
val = float(val)
|
|
58
59
|
elif col_type == TYPES.MYSQL_TYPE_LONGLONG:
|
|
59
|
-
enc =
|
|
60
|
+
enc = "<q"
|
|
60
61
|
val = int(val)
|
|
61
62
|
elif col_type == TYPES.MYSQL_TYPE_LONG:
|
|
62
|
-
enc =
|
|
63
|
+
enc = "<l"
|
|
63
64
|
val = int(val)
|
|
64
65
|
elif col_type == TYPES.MYSQL_TYPE_FLOAT:
|
|
65
|
-
enc =
|
|
66
|
+
enc = "<f"
|
|
66
67
|
val = float(val)
|
|
67
68
|
elif col_type == TYPES.MYSQL_TYPE_YEAR:
|
|
68
|
-
enc =
|
|
69
|
+
enc = "<h"
|
|
69
70
|
val = int(float(val))
|
|
70
71
|
elif col_type == TYPES.MYSQL_TYPE_SHORT:
|
|
71
|
-
enc =
|
|
72
|
+
enc = "<h"
|
|
72
73
|
val = int(val)
|
|
73
74
|
elif col_type == TYPES.MYSQL_TYPE_TINY:
|
|
74
|
-
enc =
|
|
75
|
+
enc = "<B"
|
|
75
76
|
val = int(val)
|
|
76
77
|
elif col_type == TYPES.MYSQL_TYPE_DATE:
|
|
77
78
|
env_val = self.encode_date(val)
|
|
@@ -82,42 +83,48 @@ class BinaryResultsetRowPacket(Packet):
|
|
|
82
83
|
elif col_type == TYPES.MYSQL_TYPE_TIME:
|
|
83
84
|
env_val = self.encode_time(val)
|
|
84
85
|
elif col_type == TYPES.MYSQL_TYPE_NEWDECIMAL:
|
|
85
|
-
enc =
|
|
86
|
+
enc = "string"
|
|
87
|
+
elif col_type == TYPES.MYSQL_TYPE_VECTOR:
|
|
88
|
+
enc = "byte"
|
|
89
|
+
elif col_type == TYPES.MYSQL_TYPE_JSON:
|
|
90
|
+
# json have to be encoded as byte<lenenc>, but actually for json there is no differ with string<>
|
|
91
|
+
enc = "string"
|
|
86
92
|
else:
|
|
87
|
-
enc =
|
|
93
|
+
enc = "string"
|
|
88
94
|
|
|
89
|
-
if enc ==
|
|
90
|
-
raise Exception(f
|
|
95
|
+
if enc == "":
|
|
96
|
+
raise Exception(f"Column with type {col_type} cant be encripted")
|
|
91
97
|
|
|
92
|
-
if enc ==
|
|
98
|
+
if enc == "byte":
|
|
99
|
+
self.value.append(Datum("string", val, "lenenc").toStringPacket())
|
|
100
|
+
elif enc == "string":
|
|
93
101
|
if not isinstance(val, str):
|
|
94
102
|
val = str(val)
|
|
95
|
-
self.value.append(Datum(
|
|
103
|
+
self.value.append(Datum("string", val, "lenenc").toStringPacket())
|
|
96
104
|
else:
|
|
97
105
|
if env_val is None:
|
|
98
106
|
env_val = struct.pack(enc, val)
|
|
99
107
|
self.value.append(env_val)
|
|
100
108
|
|
|
101
109
|
def encode_time(self, val: dt.time | str) -> bytes:
|
|
102
|
-
"""
|
|
103
|
-
"""
|
|
110
|
+
"""https://mariadb.com/kb/en/resultset-row/#time-binary-encoding"""
|
|
104
111
|
if isinstance(val, str):
|
|
105
112
|
try:
|
|
106
|
-
val = dt.datetime.strptime(val,
|
|
113
|
+
val = dt.datetime.strptime(val, "%H:%M:%S").time()
|
|
107
114
|
except ValueError:
|
|
108
|
-
val = dt.datetime.strptime(val,
|
|
115
|
+
val = dt.datetime.strptime(val, "%H:%M:%S.%f").time()
|
|
109
116
|
if val == dt.time(0, 0, 0):
|
|
110
|
-
return struct.pack(
|
|
111
|
-
out = struct.pack(
|
|
112
|
-
out += struct.pack(
|
|
113
|
-
out += struct.pack(
|
|
114
|
-
out += struct.pack(
|
|
115
|
-
out += struct.pack(
|
|
117
|
+
return struct.pack("<B", 0) # special case for 0 time
|
|
118
|
+
out = struct.pack("<B", 0) # positive time
|
|
119
|
+
out += struct.pack("<L", 0) # days
|
|
120
|
+
out += struct.pack("<B", val.hour)
|
|
121
|
+
out += struct.pack("<B", val.minute)
|
|
122
|
+
out += struct.pack("<B", val.second)
|
|
116
123
|
if val.microsecond > 0:
|
|
117
|
-
out += struct.pack(
|
|
118
|
-
len_bit = struct.pack(
|
|
124
|
+
out += struct.pack("<L", val.microsecond)
|
|
125
|
+
len_bit = struct.pack("<B", 12)
|
|
119
126
|
else:
|
|
120
|
-
len_bit = struct.pack(
|
|
127
|
+
len_bit = struct.pack("<B", 8)
|
|
121
128
|
return len_bit + out
|
|
122
129
|
|
|
123
130
|
def encode_date(self, val):
|
|
@@ -126,8 +133,11 @@ class BinaryResultsetRowPacket(Packet):
|
|
|
126
133
|
|
|
127
134
|
if isinstance(val, str):
|
|
128
135
|
forms = [
|
|
129
|
-
|
|
130
|
-
|
|
136
|
+
"%Y-%m-%d",
|
|
137
|
+
"%Y-%m-%d %H:%M:%S",
|
|
138
|
+
"%Y-%m-%d %H:%M:%S.%f",
|
|
139
|
+
"%Y-%m-%dT%H:%M:%S",
|
|
140
|
+
"%Y-%m-%dT%H:%M:%S.%f",
|
|
131
141
|
]
|
|
132
142
|
for f in forms:
|
|
133
143
|
try:
|
|
@@ -137,36 +147,35 @@ class BinaryResultsetRowPacket(Packet):
|
|
|
137
147
|
date_value = None
|
|
138
148
|
if date_value is None:
|
|
139
149
|
raise ValueError(f"Invalid date format: {val}")
|
|
140
|
-
date_type =
|
|
150
|
+
date_type = "datetime"
|
|
141
151
|
elif isinstance(val, pd.Timestamp):
|
|
142
152
|
date_value = val
|
|
143
|
-
date_type =
|
|
153
|
+
date_type = "datetime"
|
|
144
154
|
|
|
145
|
-
out = struct.pack(
|
|
146
|
-
out += struct.pack(
|
|
147
|
-
out += struct.pack(
|
|
155
|
+
out = struct.pack("<H", date_value.year)
|
|
156
|
+
out += struct.pack("<B", date_value.month)
|
|
157
|
+
out += struct.pack("<B", date_value.day)
|
|
148
158
|
|
|
149
|
-
if date_type ==
|
|
150
|
-
out += struct.pack(
|
|
151
|
-
out += struct.pack(
|
|
152
|
-
out += struct.pack(
|
|
153
|
-
out += struct.pack(
|
|
159
|
+
if date_type == "datetime":
|
|
160
|
+
out += struct.pack("<B", date_value.hour)
|
|
161
|
+
out += struct.pack("<B", date_value.minute)
|
|
162
|
+
out += struct.pack("<B", date_value.second)
|
|
163
|
+
out += struct.pack("<L", date_value.microsecond)
|
|
154
164
|
|
|
155
|
-
len_bit = struct.pack(
|
|
165
|
+
len_bit = struct.pack("<B", len(out))
|
|
156
166
|
return len_bit + out
|
|
157
167
|
|
|
158
168
|
@property
|
|
159
169
|
def body(self):
|
|
160
|
-
string = b
|
|
170
|
+
string = b"".join(self.value)
|
|
161
171
|
self.setBody(string)
|
|
162
172
|
return self._body
|
|
163
173
|
|
|
164
174
|
@staticmethod
|
|
165
175
|
def test():
|
|
166
176
|
import pprint
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
)
|
|
177
|
+
|
|
178
|
+
pprint.pprint(str(BinaryResultsetRowPacket().get_packet_string()))
|
|
170
179
|
|
|
171
180
|
|
|
172
181
|
if __name__ == "__main__":
|
|
@@ -15,24 +15,26 @@ from mindsdb.api.mysql.mysql_proxy.libs.constants.mysql import NULL_VALUE
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class ResultsetRowPacket(Packet):
|
|
18
|
-
|
|
18
|
+
"""
|
|
19
19
|
Implementation based on:
|
|
20
20
|
https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-ProtocolText::ResultsetRow
|
|
21
21
|
https://mariadb.com/kb/en/resultset-row/
|
|
22
|
-
|
|
22
|
+
"""
|
|
23
23
|
|
|
24
24
|
def setup(self):
|
|
25
|
-
data = self._kwargs.get(
|
|
25
|
+
data = self._kwargs.get("data", {})
|
|
26
26
|
self.value = []
|
|
27
27
|
for val in data:
|
|
28
28
|
if val is None:
|
|
29
29
|
self.value.append(NULL_VALUE)
|
|
30
|
+
elif isinstance(val, bytes):
|
|
31
|
+
self.value.append(Datum("byte<lenenc>", val))
|
|
30
32
|
else:
|
|
31
|
-
self.value.append(Datum(
|
|
33
|
+
self.value.append(Datum("string<lenenc>", str(val)))
|
|
32
34
|
|
|
33
35
|
@property
|
|
34
36
|
def body(self):
|
|
35
|
-
string = b
|
|
37
|
+
string = b""
|
|
36
38
|
for x in self.value:
|
|
37
39
|
if x is NULL_VALUE:
|
|
38
40
|
string += x
|
|
@@ -45,9 +47,8 @@ class ResultsetRowPacket(Packet):
|
|
|
45
47
|
@staticmethod
|
|
46
48
|
def test():
|
|
47
49
|
import pprint
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
50
|
+
|
|
51
|
+
pprint.pprint(str(ResultsetRowPacket().get_packet_string()))
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
if __name__ == "__main__":
|