MindsDB 25.9.2.0a1__py3-none-any.whl → 25.10.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 (164) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +40 -29
  3. mindsdb/api/a2a/__init__.py +1 -1
  4. mindsdb/api/a2a/agent.py +16 -10
  5. mindsdb/api/a2a/common/server/server.py +7 -3
  6. mindsdb/api/a2a/common/server/task_manager.py +12 -5
  7. mindsdb/api/a2a/common/types.py +66 -0
  8. mindsdb/api/a2a/task_manager.py +65 -17
  9. mindsdb/api/common/middleware.py +10 -12
  10. mindsdb/api/executor/command_executor.py +51 -40
  11. mindsdb/api/executor/datahub/datanodes/datanode.py +2 -2
  12. mindsdb/api/executor/datahub/datanodes/information_schema_datanode.py +7 -13
  13. mindsdb/api/executor/datahub/datanodes/integration_datanode.py +101 -49
  14. mindsdb/api/executor/datahub/datanodes/project_datanode.py +8 -4
  15. mindsdb/api/executor/datahub/datanodes/system_tables.py +3 -2
  16. mindsdb/api/executor/exceptions.py +29 -10
  17. mindsdb/api/executor/planner/plan_join.py +17 -3
  18. mindsdb/api/executor/planner/query_prepare.py +2 -20
  19. mindsdb/api/executor/sql_query/sql_query.py +74 -74
  20. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +1 -2
  21. mindsdb/api/executor/sql_query/steps/subselect_step.py +0 -1
  22. mindsdb/api/executor/utilities/functions.py +6 -6
  23. mindsdb/api/executor/utilities/sql.py +37 -20
  24. mindsdb/api/http/gui.py +5 -11
  25. mindsdb/api/http/initialize.py +75 -61
  26. mindsdb/api/http/namespaces/agents.py +10 -15
  27. mindsdb/api/http/namespaces/analysis.py +13 -20
  28. mindsdb/api/http/namespaces/auth.py +1 -1
  29. mindsdb/api/http/namespaces/chatbots.py +0 -5
  30. mindsdb/api/http/namespaces/config.py +15 -11
  31. mindsdb/api/http/namespaces/databases.py +140 -201
  32. mindsdb/api/http/namespaces/file.py +17 -4
  33. mindsdb/api/http/namespaces/handlers.py +17 -7
  34. mindsdb/api/http/namespaces/knowledge_bases.py +28 -7
  35. mindsdb/api/http/namespaces/models.py +94 -126
  36. mindsdb/api/http/namespaces/projects.py +13 -22
  37. mindsdb/api/http/namespaces/sql.py +33 -25
  38. mindsdb/api/http/namespaces/tab.py +27 -37
  39. mindsdb/api/http/namespaces/views.py +1 -1
  40. mindsdb/api/http/start.py +16 -10
  41. mindsdb/api/mcp/__init__.py +2 -1
  42. mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +15 -20
  43. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +26 -50
  44. mindsdb/api/mysql/mysql_proxy/utilities/__init__.py +0 -1
  45. mindsdb/api/mysql/mysql_proxy/utilities/dump.py +8 -2
  46. mindsdb/integrations/handlers/byom_handler/byom_handler.py +165 -190
  47. mindsdb/integrations/handlers/databricks_handler/databricks_handler.py +98 -46
  48. mindsdb/integrations/handlers/druid_handler/druid_handler.py +32 -40
  49. mindsdb/integrations/handlers/file_handler/file_handler.py +7 -0
  50. mindsdb/integrations/handlers/gitlab_handler/gitlab_handler.py +5 -2
  51. mindsdb/integrations/handlers/lightwood_handler/functions.py +45 -79
  52. mindsdb/integrations/handlers/mssql_handler/mssql_handler.py +438 -100
  53. mindsdb/integrations/handlers/mssql_handler/requirements_odbc.txt +3 -0
  54. mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +235 -3
  55. mindsdb/integrations/handlers/oracle_handler/__init__.py +2 -0
  56. mindsdb/integrations/handlers/oracle_handler/connection_args.py +7 -1
  57. mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +321 -16
  58. mindsdb/integrations/handlers/oracle_handler/requirements.txt +1 -1
  59. mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +14 -2
  60. mindsdb/integrations/handlers/shopify_handler/requirements.txt +1 -0
  61. mindsdb/integrations/handlers/shopify_handler/shopify_handler.py +80 -13
  62. mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +2 -1
  63. mindsdb/integrations/handlers/statsforecast_handler/requirements.txt +1 -0
  64. mindsdb/integrations/handlers/statsforecast_handler/requirements_extra.txt +1 -0
  65. mindsdb/integrations/handlers/web_handler/urlcrawl_helpers.py +4 -4
  66. mindsdb/integrations/handlers/zendesk_handler/zendesk_tables.py +144 -111
  67. mindsdb/integrations/libs/api_handler.py +10 -10
  68. mindsdb/integrations/libs/base.py +4 -4
  69. mindsdb/integrations/libs/llm/utils.py +2 -2
  70. mindsdb/integrations/libs/ml_handler_process/create_engine_process.py +4 -7
  71. mindsdb/integrations/libs/ml_handler_process/func_call_process.py +2 -7
  72. mindsdb/integrations/libs/ml_handler_process/learn_process.py +37 -47
  73. mindsdb/integrations/libs/ml_handler_process/update_engine_process.py +4 -7
  74. mindsdb/integrations/libs/ml_handler_process/update_process.py +2 -7
  75. mindsdb/integrations/libs/process_cache.py +132 -140
  76. mindsdb/integrations/libs/response.py +18 -12
  77. mindsdb/integrations/libs/vectordatabase_handler.py +26 -0
  78. mindsdb/integrations/utilities/files/file_reader.py +6 -7
  79. mindsdb/integrations/utilities/handlers/auth_utilities/snowflake/__init__.py +1 -0
  80. mindsdb/integrations/utilities/handlers/auth_utilities/snowflake/snowflake_jwt_gen.py +151 -0
  81. mindsdb/integrations/utilities/rag/config_loader.py +37 -26
  82. mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +83 -30
  83. mindsdb/integrations/utilities/rag/rerankers/reranker_compressor.py +4 -4
  84. mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py +55 -133
  85. mindsdb/integrations/utilities/rag/settings.py +58 -133
  86. mindsdb/integrations/utilities/rag/splitters/file_splitter.py +5 -15
  87. mindsdb/interfaces/agents/agents_controller.py +2 -3
  88. mindsdb/interfaces/agents/constants.py +0 -2
  89. mindsdb/interfaces/agents/litellm_server.py +34 -58
  90. mindsdb/interfaces/agents/mcp_client_agent.py +10 -10
  91. mindsdb/interfaces/agents/mindsdb_database_agent.py +5 -5
  92. mindsdb/interfaces/agents/run_mcp_agent.py +12 -21
  93. mindsdb/interfaces/chatbot/chatbot_task.py +20 -23
  94. mindsdb/interfaces/chatbot/polling.py +30 -18
  95. mindsdb/interfaces/data_catalog/data_catalog_loader.py +16 -17
  96. mindsdb/interfaces/data_catalog/data_catalog_reader.py +15 -4
  97. mindsdb/interfaces/database/data_handlers_cache.py +190 -0
  98. mindsdb/interfaces/database/database.py +3 -3
  99. mindsdb/interfaces/database/integrations.py +7 -110
  100. mindsdb/interfaces/database/projects.py +2 -6
  101. mindsdb/interfaces/database/views.py +1 -4
  102. mindsdb/interfaces/file/file_controller.py +6 -6
  103. mindsdb/interfaces/functions/controller.py +1 -1
  104. mindsdb/interfaces/functions/to_markdown.py +2 -2
  105. mindsdb/interfaces/jobs/jobs_controller.py +5 -9
  106. mindsdb/interfaces/jobs/scheduler.py +3 -9
  107. mindsdb/interfaces/knowledge_base/controller.py +244 -128
  108. mindsdb/interfaces/knowledge_base/evaluate.py +36 -41
  109. mindsdb/interfaces/knowledge_base/executor.py +11 -0
  110. mindsdb/interfaces/knowledge_base/llm_client.py +51 -17
  111. mindsdb/interfaces/knowledge_base/preprocessing/json_chunker.py +40 -61
  112. mindsdb/interfaces/model/model_controller.py +172 -168
  113. mindsdb/interfaces/query_context/context_controller.py +14 -2
  114. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +10 -14
  115. mindsdb/interfaces/skills/retrieval_tool.py +43 -50
  116. mindsdb/interfaces/skills/skill_tool.py +2 -2
  117. mindsdb/interfaces/skills/skills_controller.py +1 -4
  118. mindsdb/interfaces/skills/sql_agent.py +25 -19
  119. mindsdb/interfaces/storage/db.py +16 -6
  120. mindsdb/interfaces/storage/fs.py +114 -169
  121. mindsdb/interfaces/storage/json.py +19 -18
  122. mindsdb/interfaces/tabs/tabs_controller.py +49 -72
  123. mindsdb/interfaces/tasks/task_monitor.py +3 -9
  124. mindsdb/interfaces/tasks/task_thread.py +7 -9
  125. mindsdb/interfaces/triggers/trigger_task.py +7 -13
  126. mindsdb/interfaces/triggers/triggers_controller.py +47 -52
  127. mindsdb/migrations/migrate.py +16 -16
  128. mindsdb/utilities/api_status.py +58 -0
  129. mindsdb/utilities/config.py +68 -2
  130. mindsdb/utilities/exception.py +40 -1
  131. mindsdb/utilities/fs.py +0 -1
  132. mindsdb/utilities/hooks/profiling.py +17 -14
  133. mindsdb/utilities/json_encoder.py +24 -10
  134. mindsdb/utilities/langfuse.py +40 -45
  135. mindsdb/utilities/log.py +272 -0
  136. mindsdb/utilities/ml_task_queue/consumer.py +52 -58
  137. mindsdb/utilities/ml_task_queue/producer.py +26 -30
  138. mindsdb/utilities/render/sqlalchemy_render.py +22 -20
  139. mindsdb/utilities/starters.py +0 -10
  140. mindsdb/utilities/utils.py +2 -2
  141. {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.10.0.dist-info}/METADATA +286 -267
  142. {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.10.0.dist-info}/RECORD +145 -159
  143. mindsdb/api/mysql/mysql_proxy/utilities/exceptions.py +0 -14
  144. mindsdb/api/postgres/__init__.py +0 -0
  145. mindsdb/api/postgres/postgres_proxy/__init__.py +0 -0
  146. mindsdb/api/postgres/postgres_proxy/executor/__init__.py +0 -1
  147. mindsdb/api/postgres/postgres_proxy/executor/executor.py +0 -189
  148. mindsdb/api/postgres/postgres_proxy/postgres_packets/__init__.py +0 -0
  149. mindsdb/api/postgres/postgres_proxy/postgres_packets/errors.py +0 -322
  150. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_fields.py +0 -34
  151. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message.py +0 -31
  152. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message_formats.py +0 -1265
  153. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message_identifiers.py +0 -31
  154. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_packets.py +0 -253
  155. mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +0 -477
  156. mindsdb/api/postgres/postgres_proxy/utilities/__init__.py +0 -10
  157. mindsdb/api/postgres/start.py +0 -11
  158. mindsdb/integrations/handlers/mssql_handler/tests/__init__.py +0 -0
  159. mindsdb/integrations/handlers/mssql_handler/tests/test_mssql_handler.py +0 -169
  160. mindsdb/integrations/handlers/oracle_handler/tests/__init__.py +0 -0
  161. mindsdb/integrations/handlers/oracle_handler/tests/test_oracle_handler.py +0 -32
  162. {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.10.0.dist-info}/WHEEL +0 -0
  163. {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.10.0.dist-info}/licenses/LICENSE +0 -0
  164. {mindsdb-25.9.2.0a1.dist-info → mindsdb-25.10.0.dist-info}/top_level.txt +0 -0
@@ -1,31 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class PostgresBackendMessageIdentifier(Enum):
5
- NOTICE_RESPONSE = b'N'
6
- AUTHENTICATION_REQUEST = b'R'
7
- READY_FOR_QUERY = b'Z'
8
- COMPLETE = b'C'
9
- ERROR = b'E'
10
- ROW_DESCRIPTION = b'T'
11
- DATA_ROW = b'D'
12
- NEGOTIATE_VERSION = b'v'
13
- PARAMETER = b'S'
14
- PARSE_COMPLETE = b'1'
15
- BIND_COMPLETE = b'2'
16
- PARAMETER_DESCRIPTION = b't'
17
-
18
-
19
- class PostgresFrontendMessageIdentifier(Enum):
20
- EXECUTE = b'E'
21
- QUERY = b'Q'
22
- TERMINATE = b'X'
23
- SSL_REQUEST = b'F'
24
- PARSE = b'P'
25
- BIND = b'B'
26
- SYNC = b'S'
27
- DESCRIBE = b'D'
28
-
29
-
30
- class PostgresAuthType(Enum):
31
- PASSWORD = b'p'
@@ -1,253 +0,0 @@
1
- import struct
2
- from typing import List, Any, BinaryIO, Sequence, Dict
3
-
4
- from mindsdb.api.postgres.postgres_proxy.utilities import strip_null_byte
5
- from mindsdb.utilities import log
6
- import time
7
- from mindsdb.api.postgres.postgres_proxy.postgres_packets.postgres_fields import PostgresField
8
-
9
-
10
- from mindsdb.api.postgres.postgres_proxy.postgres_packets.postgres_message_identifiers import \
11
- PostgresBackendMessageIdentifier, PostgresFrontendMessageIdentifier, PostgresAuthType
12
-
13
-
14
- class PostgresEmptyDataException(Exception):
15
- pass
16
-
17
-
18
- class UnsupportedSSLRequest(Exception):
19
- pass
20
-
21
-
22
- class UnsupportedPostgresAuthException(Exception):
23
- pass
24
-
25
-
26
- class UnsupportedPostgresMessageType(Exception):
27
- pass
28
-
29
-
30
- class PostgresPacketReader:
31
- def __init__(self, buffer: BinaryIO):
32
- from mindsdb.api.postgres.postgres_proxy.postgres_packets.postgres_message_formats import FE_MESSAGE_MAP, \
33
- SUPPORTED_AUTH_TYPES
34
- self.fe_message_map = FE_MESSAGE_MAP
35
- self.supported_auth_types = SUPPORTED_AUTH_TYPES
36
- self.buffer = buffer
37
- self.logger = log.getLogger(__name__)
38
-
39
- def read_byte(self):
40
- return self.read_bytes(1)
41
-
42
- def read_bytes(self, n):
43
- data = self.buffer.read(n)
44
- self.logger.debug("received data:")
45
- self.logger.debug(data.hex())
46
- if not data:
47
- raise PostgresEmptyDataException("Expected data inside of buffer when performing read_bytes")
48
- else:
49
- return data
50
-
51
- def read_string(self):
52
- result = b""
53
- while True:
54
- b = self.read_byte()
55
- if b == b"\x00":
56
- break
57
- result = result + b
58
- return result
59
-
60
- def read_bytes_timeout(self, n, timeout=60):
61
- cur = time.time()
62
- end = cur + timeout
63
- # This is a reason to switch from socketserver to asyncio
64
- while cur < end:
65
- cur = time.time()
66
- data = self.buffer.read(n)
67
- if not data:
68
- pass
69
- else:
70
- return data
71
- raise PostgresEmptyDataException("Expected data inside of buffer when performing read_bytes")
72
-
73
- def read_int16(self):
74
- data = self.read_bytes(2)
75
- return struct.unpack("!h", data)[0]
76
-
77
- def read_int32(self):
78
- data = self.read_bytes(4)
79
- return struct.unpack("!i", data)[0]
80
-
81
- def read_parameters(self, n):
82
- data = self.read_bytes(n)
83
- return data.split(b'\x00')
84
-
85
- def read_verify_ssl_request(self):
86
- self.logger.debug("reading ssl")
87
- length = self.read_int32()
88
- code = self.read_int32()
89
- if length != 8 and code != 80877103:
90
- raise UnsupportedSSLRequest("Code %s of len %s" % (code, length))
91
-
92
- def read_startup_message(self) -> Dict[bytes, bytes]:
93
- self.logger.debug("reading startup message")
94
- length = self.read_int32()
95
- version = self.read_int32()
96
- major_version = version >> 16
97
- minor_version = version & 0xffff
98
- message = self.read_parameters(length - 8)
99
- self.logger.debug('PSQL Startup Message %d.%d : %s' % (major_version, minor_version, message))
100
- parameters = {}
101
- while len(message) != 0:
102
- key = message.pop(0)
103
- value = message.pop(0)
104
- parameters[key] = value
105
- parameters[b"major_version"] = major_version
106
- parameters[b"minor_version"] = minor_version
107
- return parameters
108
-
109
- def read_authentication(self, encoding=None):
110
- try:
111
- auth_type = self.read_byte()
112
- except PostgresEmptyDataException:
113
- # No authentication parameters specified. Which is fine if we're local on a mindsdbuser
114
- return ''
115
- try:
116
- auth_type = PostgresAuthType(auth_type)
117
- except Exception as e:
118
- raise UnsupportedPostgresAuthException(e)
119
- if auth_type not in self.supported_auth_types:
120
- raise UnsupportedPostgresAuthException("%s is not a supported auth type identifier" % auth_type)
121
- length = self.read_int32()
122
- password = strip_null_byte(self.read_bytes(length - 4), encoding=encoding) # password. Do something with later. We read to clear buffer.
123
- return password
124
-
125
- def read_message(self):
126
- try:
127
- message_type = self.read_byte()
128
- except PostgresEmptyDataException:
129
- self.logger.warn("Postgres Proxy: Received empty data string")
130
- return None
131
- try:
132
- message_type = PostgresFrontendMessageIdentifier(message_type)
133
- except Exception as e:
134
- raise UnsupportedPostgresMessageType(
135
- "%s is not a supported frontend message identifier:\n%s" % (message_type, str(e)))
136
-
137
- if message_type in self.fe_message_map:
138
- self.logger.debug("reading message type %s" % str(message_type.name))
139
- return self.fe_message_map[message_type]().read(self)
140
- else:
141
- raise UnsupportedPostgresMessageType(
142
- "%s is not a supported frontend message identifier" % message_type.value)
143
-
144
-
145
- class PostgresPacketBuilder:
146
- identifier: bytes
147
- pack_string: str
148
- length: int
149
- pack_args: List[Any]
150
-
151
- def __init__(self):
152
- self.logger = log.getLogger(__name__)
153
- self.reset()
154
-
155
- def reset(self):
156
- self.identifier = b''
157
- self.pack_string = ''
158
- self.pack_args = []
159
- self.length = 0
160
-
161
- def set_identifier(self, message_identifier: PostgresBackendMessageIdentifier):
162
- self.identifier = message_identifier.value
163
- return self
164
-
165
- def add_length(self, length: int):
166
- self.length += length
167
- return self
168
-
169
- def write_char(self, c, write_file: BinaryIO):
170
- pack = "!c"
171
- packed_binary = struct.pack(pack, c)
172
- write_file.write(packed_binary)
173
-
174
- def write(self, write_file: BinaryIO):
175
- if len(self.identifier) == 0:
176
- raise Exception("Can't write without identifier.")
177
- pack = "!c"
178
-
179
- # Send length
180
- # Ensures 'i' in pack and self.length in 2nd position of respective variables.
181
- # Also adds 4 to length to include int32 rep of length
182
- self.length += 4
183
- pack += "i"
184
- self.pack_args = [self.length] + self.pack_args
185
-
186
- pack += self.pack_string
187
- self.logger.debug("writing:")
188
- self.logger.debug("pack string: %s" % self.pack_string)
189
- self.logger.debug("identifier: %s" % self.pack_string)
190
- self.logger.debug("pack args:")
191
- for arg in self.pack_args:
192
- self.logger.debug("arg: %s" % str(arg))
193
- packed_binary = struct.pack(pack, self.identifier, *self.pack_args)
194
- write_file.write(packed_binary)
195
-
196
- def add_char(self, s: bytes):
197
- self.pack_string += 'c'
198
- if len(s) != 1:
199
- raise Exception("Char must be of length 1 in add_char")
200
- self.pack_args.append(s)
201
- return self.add_length(1)
202
-
203
- def add_string(self, s: bytes):
204
- s = s + b'\x00'
205
- self.pack_string += str(len(s)) + 's'
206
- self.pack_args.append(s)
207
- return self.add_length(len(s))
208
-
209
- def add_int32(self, i):
210
- self.pack_string += 'i'
211
- self.pack_args.append(i)
212
- return self.add_length(4)
213
-
214
- def add_int16(self, h):
215
- self.pack_string += 'h'
216
- self.pack_args.append(h)
217
- return self.add_length(2)
218
-
219
- def add_bytes(self, b: bytes):
220
- if len(b) == 1:
221
- self.pack_string += 's'
222
- else:
223
- self.pack_string += str(len(b)) + 's'
224
- self.pack_args.append(b)
225
- return self.add_length(len(b))
226
-
227
- def add_field(self, field: PostgresField):
228
- return self.add_string(field.name.encode()) \
229
- .add_int32(field.table_id) \
230
- .add_int16(field.column_id) \
231
- .add_int32(field.object_id) \
232
- .add_int16(field.dt_size) \
233
- .add_int32(field.type_modifier) \
234
- .add_int16(field.format_code)
235
-
236
- def add_fields(self, fields: Sequence[PostgresField]):
237
- for field in fields:
238
- self.add_field(field)
239
- return self
240
-
241
- def add_column_value(self, val: bytes):
242
- if val == b'NULL':
243
- self.add_int32(-1)
244
- return self
245
-
246
- self.add_int32(len(val))
247
- self.add_bytes(val)
248
- return self
249
-
250
- def add_row(self, row: Sequence[bytes]):
251
- for val in row:
252
- self.add_column_value(val)
253
- return self