MindsDB 25.9.3rc1__py3-none-any.whl → 25.10.0rc1__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 +1 -9
- mindsdb/api/a2a/__init__.py +1 -1
- mindsdb/api/a2a/agent.py +9 -1
- mindsdb/api/a2a/common/server/server.py +4 -0
- mindsdb/api/a2a/common/server/task_manager.py +8 -1
- mindsdb/api/a2a/common/types.py +66 -0
- mindsdb/api/a2a/task_manager.py +50 -0
- mindsdb/api/common/middleware.py +1 -1
- mindsdb/api/executor/command_executor.py +49 -36
- mindsdb/api/executor/datahub/datanodes/information_schema_datanode.py +7 -13
- mindsdb/api/executor/datahub/datanodes/integration_datanode.py +2 -2
- mindsdb/api/executor/datahub/datanodes/system_tables.py +2 -1
- mindsdb/api/executor/planner/query_prepare.py +2 -20
- mindsdb/api/executor/utilities/sql.py +5 -4
- mindsdb/api/http/initialize.py +76 -60
- mindsdb/api/http/namespaces/agents.py +0 -3
- mindsdb/api/http/namespaces/chatbots.py +0 -5
- mindsdb/api/http/namespaces/file.py +2 -0
- mindsdb/api/http/namespaces/handlers.py +10 -5
- mindsdb/api/http/namespaces/knowledge_bases.py +20 -0
- mindsdb/api/http/namespaces/sql.py +2 -2
- mindsdb/api/http/start.py +2 -2
- mindsdb/api/mysql/mysql_proxy/utilities/dump.py +8 -2
- mindsdb/integrations/handlers/byom_handler/byom_handler.py +2 -10
- mindsdb/integrations/handlers/databricks_handler/databricks_handler.py +98 -46
- mindsdb/integrations/handlers/druid_handler/druid_handler.py +32 -40
- mindsdb/integrations/handlers/gitlab_handler/gitlab_handler.py +5 -2
- mindsdb/integrations/handlers/mssql_handler/mssql_handler.py +438 -100
- mindsdb/integrations/handlers/mssql_handler/requirements_odbc.txt +3 -0
- mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +235 -3
- mindsdb/integrations/handlers/oracle_handler/__init__.py +2 -0
- mindsdb/integrations/handlers/oracle_handler/connection_args.py +7 -1
- mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +321 -16
- mindsdb/integrations/handlers/oracle_handler/requirements.txt +1 -1
- mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +2 -2
- mindsdb/integrations/handlers/zendesk_handler/zendesk_tables.py +144 -111
- mindsdb/integrations/libs/response.py +2 -2
- mindsdb/integrations/utilities/handlers/auth_utilities/snowflake/__init__.py +1 -0
- mindsdb/integrations/utilities/handlers/auth_utilities/snowflake/snowflake_jwt_gen.py +151 -0
- mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +24 -21
- mindsdb/interfaces/agents/agents_controller.py +0 -2
- mindsdb/interfaces/data_catalog/data_catalog_loader.py +6 -7
- mindsdb/interfaces/data_catalog/data_catalog_reader.py +15 -4
- mindsdb/interfaces/database/data_handlers_cache.py +190 -0
- mindsdb/interfaces/database/database.py +3 -3
- mindsdb/interfaces/database/integrations.py +1 -121
- mindsdb/interfaces/database/projects.py +2 -6
- mindsdb/interfaces/database/views.py +1 -4
- mindsdb/interfaces/jobs/jobs_controller.py +0 -4
- mindsdb/interfaces/jobs/scheduler.py +0 -1
- mindsdb/interfaces/knowledge_base/controller.py +197 -108
- mindsdb/interfaces/knowledge_base/evaluate.py +36 -41
- mindsdb/interfaces/knowledge_base/executor.py +11 -0
- mindsdb/interfaces/knowledge_base/llm_client.py +51 -17
- mindsdb/interfaces/model/model_controller.py +4 -4
- mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +4 -10
- mindsdb/interfaces/skills/skills_controller.py +1 -4
- mindsdb/interfaces/storage/db.py +16 -6
- mindsdb/interfaces/triggers/triggers_controller.py +1 -3
- mindsdb/utilities/config.py +19 -2
- mindsdb/utilities/exception.py +2 -2
- mindsdb/utilities/json_encoder.py +24 -10
- mindsdb/utilities/render/sqlalchemy_render.py +15 -14
- mindsdb/utilities/starters.py +0 -10
- {mindsdb-25.9.3rc1.dist-info → mindsdb-25.10.0rc1.dist-info}/METADATA +276 -264
- {mindsdb-25.9.3rc1.dist-info → mindsdb-25.10.0rc1.dist-info}/RECORD +70 -84
- mindsdb/api/postgres/__init__.py +0 -0
- mindsdb/api/postgres/postgres_proxy/__init__.py +0 -0
- mindsdb/api/postgres/postgres_proxy/executor/__init__.py +0 -1
- mindsdb/api/postgres/postgres_proxy/executor/executor.py +0 -182
- mindsdb/api/postgres/postgres_proxy/postgres_packets/__init__.py +0 -0
- mindsdb/api/postgres/postgres_proxy/postgres_packets/errors.py +0 -322
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_fields.py +0 -34
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message.py +0 -31
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message_formats.py +0 -1265
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message_identifiers.py +0 -31
- mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_packets.py +0 -265
- mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +0 -477
- mindsdb/api/postgres/postgres_proxy/utilities/__init__.py +0 -10
- mindsdb/api/postgres/start.py +0 -11
- mindsdb/integrations/handlers/mssql_handler/tests/__init__.py +0 -0
- mindsdb/integrations/handlers/mssql_handler/tests/test_mssql_handler.py +0 -169
- mindsdb/integrations/handlers/oracle_handler/tests/__init__.py +0 -0
- mindsdb/integrations/handlers/oracle_handler/tests/test_oracle_handler.py +0 -32
- {mindsdb-25.9.3rc1.dist-info → mindsdb-25.10.0rc1.dist-info}/WHEEL +0 -0
- {mindsdb-25.9.3rc1.dist-info → mindsdb-25.10.0rc1.dist-info}/licenses/LICENSE +0 -0
- {mindsdb-25.9.3rc1.dist-info → mindsdb-25.10.0rc1.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,265 +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,
|
|
12
|
-
PostgresFrontendMessageIdentifier,
|
|
13
|
-
PostgresAuthType,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class PostgresEmptyDataException(Exception):
|
|
18
|
-
pass
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class UnsupportedSSLRequest(Exception):
|
|
22
|
-
pass
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class UnsupportedPostgresAuthException(Exception):
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class UnsupportedPostgresMessageType(Exception):
|
|
30
|
-
pass
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class PostgresPacketReader:
|
|
34
|
-
def __init__(self, buffer: BinaryIO):
|
|
35
|
-
from mindsdb.api.postgres.postgres_proxy.postgres_packets.postgres_message_formats import (
|
|
36
|
-
FE_MESSAGE_MAP,
|
|
37
|
-
SUPPORTED_AUTH_TYPES,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
self.fe_message_map = FE_MESSAGE_MAP
|
|
41
|
-
self.supported_auth_types = SUPPORTED_AUTH_TYPES
|
|
42
|
-
self.buffer = buffer
|
|
43
|
-
self.logger = log.getLogger(__name__)
|
|
44
|
-
|
|
45
|
-
def read_byte(self):
|
|
46
|
-
return self.read_bytes(1)
|
|
47
|
-
|
|
48
|
-
def read_bytes(self, n):
|
|
49
|
-
data = self.buffer.read(n)
|
|
50
|
-
self.logger.debug("received data:")
|
|
51
|
-
self.logger.debug(data.hex())
|
|
52
|
-
if not data:
|
|
53
|
-
raise PostgresEmptyDataException("Expected data inside of buffer when performing read_bytes")
|
|
54
|
-
else:
|
|
55
|
-
return data
|
|
56
|
-
|
|
57
|
-
def read_string(self):
|
|
58
|
-
result = b""
|
|
59
|
-
while True:
|
|
60
|
-
b = self.read_byte()
|
|
61
|
-
if b == b"\x00":
|
|
62
|
-
break
|
|
63
|
-
result = result + b
|
|
64
|
-
return result
|
|
65
|
-
|
|
66
|
-
def read_bytes_timeout(self, n, timeout=60):
|
|
67
|
-
cur = time.time()
|
|
68
|
-
end = cur + timeout
|
|
69
|
-
# This is a reason to switch from socketserver to asyncio
|
|
70
|
-
while cur < end:
|
|
71
|
-
cur = time.time()
|
|
72
|
-
data = self.buffer.read(n)
|
|
73
|
-
if not data:
|
|
74
|
-
pass
|
|
75
|
-
else:
|
|
76
|
-
return data
|
|
77
|
-
raise PostgresEmptyDataException("Expected data inside of buffer when performing read_bytes")
|
|
78
|
-
|
|
79
|
-
def read_int16(self):
|
|
80
|
-
data = self.read_bytes(2)
|
|
81
|
-
return struct.unpack("!h", data)[0]
|
|
82
|
-
|
|
83
|
-
def read_int32(self):
|
|
84
|
-
data = self.read_bytes(4)
|
|
85
|
-
return struct.unpack("!i", data)[0]
|
|
86
|
-
|
|
87
|
-
def read_parameters(self, n):
|
|
88
|
-
data = self.read_bytes(n)
|
|
89
|
-
return data.split(b"\x00")
|
|
90
|
-
|
|
91
|
-
def read_verify_ssl_request(self):
|
|
92
|
-
self.logger.debug("reading ssl")
|
|
93
|
-
length = self.read_int32()
|
|
94
|
-
code = self.read_int32()
|
|
95
|
-
if length != 8 and code != 80877103:
|
|
96
|
-
raise UnsupportedSSLRequest("Code %s of len %s" % (code, length))
|
|
97
|
-
|
|
98
|
-
def read_startup_message(self) -> Dict[bytes, bytes]:
|
|
99
|
-
self.logger.debug("reading startup message")
|
|
100
|
-
length = self.read_int32()
|
|
101
|
-
version = self.read_int32()
|
|
102
|
-
major_version = version >> 16
|
|
103
|
-
minor_version = version & 0xFFFF
|
|
104
|
-
message = self.read_parameters(length - 8)
|
|
105
|
-
self.logger.debug("PSQL Startup Message %d.%d : %s" % (major_version, minor_version, message))
|
|
106
|
-
parameters = {}
|
|
107
|
-
while len(message) != 0:
|
|
108
|
-
key = message.pop(0)
|
|
109
|
-
value = message.pop(0)
|
|
110
|
-
parameters[key] = value
|
|
111
|
-
parameters[b"major_version"] = major_version
|
|
112
|
-
parameters[b"minor_version"] = minor_version
|
|
113
|
-
return parameters
|
|
114
|
-
|
|
115
|
-
def read_authentication(self, encoding=None):
|
|
116
|
-
try:
|
|
117
|
-
auth_type = self.read_byte()
|
|
118
|
-
except PostgresEmptyDataException:
|
|
119
|
-
# No authentication parameters specified. Which is fine if we're local on a mindsdbuser
|
|
120
|
-
return ""
|
|
121
|
-
try:
|
|
122
|
-
auth_type = PostgresAuthType(auth_type)
|
|
123
|
-
except Exception as e:
|
|
124
|
-
raise UnsupportedPostgresAuthException(e)
|
|
125
|
-
if auth_type not in self.supported_auth_types:
|
|
126
|
-
raise UnsupportedPostgresAuthException("%s is not a supported auth type identifier" % auth_type)
|
|
127
|
-
length = self.read_int32()
|
|
128
|
-
password = strip_null_byte(
|
|
129
|
-
self.read_bytes(length - 4), encoding=encoding
|
|
130
|
-
) # password. Do something with later. We read to clear buffer.
|
|
131
|
-
return password
|
|
132
|
-
|
|
133
|
-
def read_message(self):
|
|
134
|
-
try:
|
|
135
|
-
message_type = self.read_byte()
|
|
136
|
-
except PostgresEmptyDataException:
|
|
137
|
-
self.logger.warning("Postgres Proxy: Received empty data string")
|
|
138
|
-
return None
|
|
139
|
-
try:
|
|
140
|
-
message_type = PostgresFrontendMessageIdentifier(message_type)
|
|
141
|
-
except Exception as e:
|
|
142
|
-
raise UnsupportedPostgresMessageType(
|
|
143
|
-
"%s is not a supported frontend message identifier:\n%s" % (message_type, str(e))
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
if message_type in self.fe_message_map:
|
|
147
|
-
self.logger.debug("reading message type %s" % str(message_type.name))
|
|
148
|
-
return self.fe_message_map[message_type]().read(self)
|
|
149
|
-
else:
|
|
150
|
-
raise UnsupportedPostgresMessageType(
|
|
151
|
-
"%s is not a supported frontend message identifier" % message_type.value
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
class PostgresPacketBuilder:
|
|
156
|
-
identifier: bytes
|
|
157
|
-
pack_string: str
|
|
158
|
-
length: int
|
|
159
|
-
pack_args: List[Any]
|
|
160
|
-
|
|
161
|
-
def __init__(self):
|
|
162
|
-
self.logger = log.getLogger(__name__)
|
|
163
|
-
self.reset()
|
|
164
|
-
|
|
165
|
-
def reset(self):
|
|
166
|
-
self.identifier = b""
|
|
167
|
-
self.pack_string = ""
|
|
168
|
-
self.pack_args = []
|
|
169
|
-
self.length = 0
|
|
170
|
-
|
|
171
|
-
def set_identifier(self, message_identifier: PostgresBackendMessageIdentifier):
|
|
172
|
-
self.identifier = message_identifier.value
|
|
173
|
-
return self
|
|
174
|
-
|
|
175
|
-
def add_length(self, length: int):
|
|
176
|
-
self.length += length
|
|
177
|
-
return self
|
|
178
|
-
|
|
179
|
-
def write_char(self, c, write_file: BinaryIO):
|
|
180
|
-
pack = "!c"
|
|
181
|
-
packed_binary = struct.pack(pack, c)
|
|
182
|
-
write_file.write(packed_binary)
|
|
183
|
-
|
|
184
|
-
def write(self, write_file: BinaryIO):
|
|
185
|
-
if len(self.identifier) == 0:
|
|
186
|
-
raise Exception("Can't write without identifier.")
|
|
187
|
-
pack = "!c"
|
|
188
|
-
|
|
189
|
-
# Send length
|
|
190
|
-
# Ensures 'i' in pack and self.length in 2nd position of respective variables.
|
|
191
|
-
# Also adds 4 to length to include int32 rep of length
|
|
192
|
-
self.length += 4
|
|
193
|
-
pack += "i"
|
|
194
|
-
self.pack_args = [self.length] + self.pack_args
|
|
195
|
-
|
|
196
|
-
pack += self.pack_string
|
|
197
|
-
self.logger.debug("writing:")
|
|
198
|
-
self.logger.debug("pack string: %s" % self.pack_string)
|
|
199
|
-
self.logger.debug("identifier: %s" % self.pack_string)
|
|
200
|
-
self.logger.debug("pack args:")
|
|
201
|
-
for arg in self.pack_args:
|
|
202
|
-
self.logger.debug("arg: %s" % str(arg))
|
|
203
|
-
packed_binary = struct.pack(pack, self.identifier, *self.pack_args)
|
|
204
|
-
write_file.write(packed_binary)
|
|
205
|
-
|
|
206
|
-
def add_char(self, s: bytes):
|
|
207
|
-
self.pack_string += "c"
|
|
208
|
-
if len(s) != 1:
|
|
209
|
-
raise Exception("Char must be of length 1 in add_char")
|
|
210
|
-
self.pack_args.append(s)
|
|
211
|
-
return self.add_length(1)
|
|
212
|
-
|
|
213
|
-
def add_string(self, s: bytes):
|
|
214
|
-
s = s + b"\x00"
|
|
215
|
-
self.pack_string += str(len(s)) + "s"
|
|
216
|
-
self.pack_args.append(s)
|
|
217
|
-
return self.add_length(len(s))
|
|
218
|
-
|
|
219
|
-
def add_int32(self, i):
|
|
220
|
-
self.pack_string += "i"
|
|
221
|
-
self.pack_args.append(i)
|
|
222
|
-
return self.add_length(4)
|
|
223
|
-
|
|
224
|
-
def add_int16(self, h):
|
|
225
|
-
self.pack_string += "h"
|
|
226
|
-
self.pack_args.append(h)
|
|
227
|
-
return self.add_length(2)
|
|
228
|
-
|
|
229
|
-
def add_bytes(self, b: bytes):
|
|
230
|
-
if len(b) == 1:
|
|
231
|
-
self.pack_string += "s"
|
|
232
|
-
else:
|
|
233
|
-
self.pack_string += str(len(b)) + "s"
|
|
234
|
-
self.pack_args.append(b)
|
|
235
|
-
return self.add_length(len(b))
|
|
236
|
-
|
|
237
|
-
def add_field(self, field: PostgresField):
|
|
238
|
-
return (
|
|
239
|
-
self.add_string(field.name.encode())
|
|
240
|
-
.add_int32(field.table_id)
|
|
241
|
-
.add_int16(field.column_id)
|
|
242
|
-
.add_int32(field.object_id)
|
|
243
|
-
.add_int16(field.dt_size)
|
|
244
|
-
.add_int32(field.type_modifier)
|
|
245
|
-
.add_int16(field.format_code)
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
def add_fields(self, fields: Sequence[PostgresField]):
|
|
249
|
-
for field in fields:
|
|
250
|
-
self.add_field(field)
|
|
251
|
-
return self
|
|
252
|
-
|
|
253
|
-
def add_column_value(self, val: bytes):
|
|
254
|
-
if val == b"NULL":
|
|
255
|
-
self.add_int32(-1)
|
|
256
|
-
return self
|
|
257
|
-
|
|
258
|
-
self.add_int32(len(val))
|
|
259
|
-
self.add_bytes(val)
|
|
260
|
-
return self
|
|
261
|
-
|
|
262
|
-
def add_row(self, row: Sequence[bytes]):
|
|
263
|
-
for val in row:
|
|
264
|
-
self.add_column_value(val)
|
|
265
|
-
return self
|