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.

Files changed (70) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/api/a2a/agent.py +28 -25
  3. mindsdb/api/a2a/common/server/server.py +32 -26
  4. mindsdb/api/a2a/run_a2a.py +1 -1
  5. mindsdb/api/executor/command_executor.py +69 -14
  6. mindsdb/api/executor/datahub/datanodes/integration_datanode.py +49 -65
  7. mindsdb/api/executor/datahub/datanodes/project_datanode.py +29 -48
  8. mindsdb/api/executor/datahub/datanodes/system_tables.py +35 -61
  9. mindsdb/api/executor/planner/plan_join.py +67 -77
  10. mindsdb/api/executor/planner/query_planner.py +176 -155
  11. mindsdb/api/executor/planner/steps.py +37 -12
  12. mindsdb/api/executor/sql_query/result_set.py +45 -64
  13. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +14 -18
  14. mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +17 -18
  15. mindsdb/api/executor/sql_query/steps/insert_step.py +13 -33
  16. mindsdb/api/executor/sql_query/steps/subselect_step.py +43 -35
  17. mindsdb/api/executor/utilities/sql.py +42 -48
  18. mindsdb/api/http/namespaces/config.py +1 -1
  19. mindsdb/api/http/namespaces/file.py +14 -23
  20. mindsdb/api/mysql/mysql_proxy/data_types/mysql_datum.py +12 -28
  21. mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/binary_resultset_row_package.py +59 -50
  22. mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/resultset_row_package.py +9 -8
  23. mindsdb/api/mysql/mysql_proxy/libs/constants/mysql.py +449 -461
  24. mindsdb/api/mysql/mysql_proxy/utilities/dump.py +87 -36
  25. mindsdb/integrations/handlers/file_handler/file_handler.py +15 -9
  26. mindsdb/integrations/handlers/file_handler/tests/test_file_handler.py +43 -24
  27. mindsdb/integrations/handlers/litellm_handler/litellm_handler.py +10 -3
  28. mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +26 -33
  29. mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +74 -51
  30. mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +305 -98
  31. mindsdb/integrations/handlers/salesforce_handler/salesforce_handler.py +53 -34
  32. mindsdb/integrations/handlers/salesforce_handler/salesforce_tables.py +136 -6
  33. mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +334 -83
  34. mindsdb/integrations/libs/api_handler.py +261 -57
  35. mindsdb/integrations/libs/base.py +100 -29
  36. mindsdb/integrations/utilities/files/file_reader.py +99 -73
  37. mindsdb/integrations/utilities/handler_utils.py +23 -8
  38. mindsdb/integrations/utilities/sql_utils.py +35 -40
  39. mindsdb/interfaces/agents/agents_controller.py +196 -192
  40. mindsdb/interfaces/agents/constants.py +7 -1
  41. mindsdb/interfaces/agents/langchain_agent.py +42 -11
  42. mindsdb/interfaces/agents/mcp_client_agent.py +29 -21
  43. mindsdb/interfaces/data_catalog/__init__.py +0 -0
  44. mindsdb/interfaces/data_catalog/base_data_catalog.py +54 -0
  45. mindsdb/interfaces/data_catalog/data_catalog_loader.py +359 -0
  46. mindsdb/interfaces/data_catalog/data_catalog_reader.py +34 -0
  47. mindsdb/interfaces/database/database.py +81 -57
  48. mindsdb/interfaces/database/integrations.py +220 -234
  49. mindsdb/interfaces/database/log.py +72 -104
  50. mindsdb/interfaces/database/projects.py +156 -193
  51. mindsdb/interfaces/file/file_controller.py +21 -65
  52. mindsdb/interfaces/knowledge_base/controller.py +63 -10
  53. mindsdb/interfaces/knowledge_base/evaluate.py +519 -0
  54. mindsdb/interfaces/knowledge_base/llm_client.py +75 -0
  55. mindsdb/interfaces/skills/custom/text2sql/mindsdb_kb_tools.py +83 -43
  56. mindsdb/interfaces/skills/skills_controller.py +54 -36
  57. mindsdb/interfaces/skills/sql_agent.py +109 -86
  58. mindsdb/interfaces/storage/db.py +223 -79
  59. mindsdb/migrations/versions/2025-05-28_a44643042fe8_added_data_catalog_tables.py +118 -0
  60. mindsdb/migrations/versions/2025-06-09_608e376c19a7_updated_data_catalog_data_types.py +58 -0
  61. mindsdb/utilities/config.py +9 -2
  62. mindsdb/utilities/log.py +35 -26
  63. mindsdb/utilities/ml_task_queue/task.py +19 -22
  64. mindsdb/utilities/render/sqlalchemy_render.py +129 -181
  65. mindsdb/utilities/starters.py +49 -1
  66. {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/METADATA +268 -268
  67. {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/RECORD +70 -62
  68. {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/WHEEL +0 -0
  69. {mindsdb-25.5.4.1.dist-info → mindsdb-25.6.2.0.dist-info}/licenses/LICENSE +0 -0
  70. {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('data', {})
30
- columns = self._kwargs.get('columns', {})
30
+ data = self._kwargs.get("data", {})
31
+ columns = self._kwargs.get("columns", {})
31
32
 
32
- self.value = [b'\x00']
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] |= (1 << bit_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['type']
55
+ col_type = col["type"]
55
56
  if col_type == TYPES.MYSQL_TYPE_DOUBLE:
56
- enc = '<d'
57
+ enc = "<d"
57
58
  val = float(val)
58
59
  elif col_type == TYPES.MYSQL_TYPE_LONGLONG:
59
- enc = '<q'
60
+ enc = "<q"
60
61
  val = int(val)
61
62
  elif col_type == TYPES.MYSQL_TYPE_LONG:
62
- enc = '<l'
63
+ enc = "<l"
63
64
  val = int(val)
64
65
  elif col_type == TYPES.MYSQL_TYPE_FLOAT:
65
- enc = '<f'
66
+ enc = "<f"
66
67
  val = float(val)
67
68
  elif col_type == TYPES.MYSQL_TYPE_YEAR:
68
- enc = '<h'
69
+ enc = "<h"
69
70
  val = int(float(val))
70
71
  elif col_type == TYPES.MYSQL_TYPE_SHORT:
71
- enc = '<h'
72
+ enc = "<h"
72
73
  val = int(val)
73
74
  elif col_type == TYPES.MYSQL_TYPE_TINY:
74
- enc = '<B'
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 = 'string'
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 = 'string'
93
+ enc = "string"
88
94
 
89
- if enc == '':
90
- raise Exception(f'Column with type {col_type} cant be encripted')
95
+ if enc == "":
96
+ raise Exception(f"Column with type {col_type} cant be encripted")
91
97
 
92
- if enc == 'string':
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('string', val, 'lenenc').toStringPacket())
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
- """ https://mariadb.com/kb/en/resultset-row/#time-binary-encoding
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, '%H:%M:%S').time()
113
+ val = dt.datetime.strptime(val, "%H:%M:%S").time()
107
114
  except ValueError:
108
- val = dt.datetime.strptime(val, '%H:%M:%S.%f').time()
115
+ val = dt.datetime.strptime(val, "%H:%M:%S.%f").time()
109
116
  if val == dt.time(0, 0, 0):
110
- return struct.pack('<B', 0) # special case for 0 time
111
- out = struct.pack('<B', 0) # positive time
112
- out += struct.pack('<L', 0) # days
113
- out += struct.pack('<B', val.hour)
114
- out += struct.pack('<B', val.minute)
115
- out += struct.pack('<B', val.second)
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('<L', val.microsecond)
118
- len_bit = struct.pack('<B', 12)
124
+ out += struct.pack("<L", val.microsecond)
125
+ len_bit = struct.pack("<B", 12)
119
126
  else:
120
- len_bit = struct.pack('<B', 8)
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
- '%Y-%m-%d', '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f',
130
- '%Y-%m-%dT%H:%M:%S', '%Y-%m-%dT%H:%M:%S.%f'
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 = 'datetime'
150
+ date_type = "datetime"
141
151
  elif isinstance(val, pd.Timestamp):
142
152
  date_value = val
143
- date_type = 'datetime'
153
+ date_type = "datetime"
144
154
 
145
- out = struct.pack('<H', date_value.year)
146
- out += struct.pack('<B', date_value.month)
147
- out += struct.pack('<B', date_value.day)
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 == 'datetime':
150
- out += struct.pack('<B', date_value.hour)
151
- out += struct.pack('<B', date_value.minute)
152
- out += struct.pack('<B', date_value.second)
153
- out += struct.pack('<L', date_value.microsecond)
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('<B', len(out))
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''.join(self.value)
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
- pprint.pprint(
168
- str(BinaryResultsetRowPacket().get_packet_string())
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('data', {})
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('string<lenenc>', str(val)))
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
- pprint.pprint(
49
- str(ResultsetRowPacket().get_packet_string())
50
- )
50
+
51
+ pprint.pprint(str(ResultsetRowPacket().get_packet_string()))
51
52
 
52
53
 
53
54
  if __name__ == "__main__":