MindsDB 25.8.3.0__py3-none-any.whl → 25.9.1.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 (94) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +2 -44
  3. mindsdb/api/a2a/__init__.py +52 -0
  4. mindsdb/api/a2a/agent.py +11 -12
  5. mindsdb/api/a2a/common/server/server.py +17 -36
  6. mindsdb/api/a2a/common/server/task_manager.py +14 -28
  7. mindsdb/api/a2a/task_manager.py +20 -21
  8. mindsdb/api/a2a/utils.py +1 -1
  9. mindsdb/api/common/middleware.py +106 -0
  10. mindsdb/api/http/initialize.py +13 -15
  11. mindsdb/api/http/namespaces/auth.py +6 -14
  12. mindsdb/api/http/namespaces/config.py +0 -2
  13. mindsdb/api/http/namespaces/default.py +74 -106
  14. mindsdb/api/http/start.py +25 -44
  15. mindsdb/api/litellm/start.py +11 -10
  16. mindsdb/api/mcp/__init__.py +165 -0
  17. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +33 -64
  18. mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +86 -85
  19. mindsdb/integrations/handlers/crate_handler/crate_handler.py +3 -7
  20. mindsdb/integrations/handlers/derby_handler/derby_handler.py +32 -34
  21. mindsdb/integrations/handlers/documentdb_handler/requirements.txt +1 -0
  22. mindsdb/integrations/handlers/dummy_data_handler/dummy_data_handler.py +12 -13
  23. mindsdb/integrations/handlers/google_books_handler/google_books_handler.py +45 -44
  24. mindsdb/integrations/handlers/google_calendar_handler/google_calendar_handler.py +101 -95
  25. mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_handler.py +129 -129
  26. mindsdb/integrations/handlers/google_fit_handler/google_fit_handler.py +59 -43
  27. mindsdb/integrations/handlers/google_search_handler/google_search_handler.py +38 -39
  28. mindsdb/integrations/handlers/informix_handler/informix_handler.py +5 -18
  29. mindsdb/integrations/handlers/maxdb_handler/maxdb_handler.py +22 -28
  30. mindsdb/integrations/handlers/monetdb_handler/monetdb_handler.py +3 -7
  31. mindsdb/integrations/handlers/mongodb_handler/mongodb_handler.py +53 -67
  32. mindsdb/integrations/handlers/mongodb_handler/requirements.txt +1 -0
  33. mindsdb/{api/mongo/utilities → integrations/handlers/mongodb_handler/utils}/mongodb_ast.py +43 -68
  34. mindsdb/{api/mongo/utilities → integrations/handlers/mongodb_handler/utils}/mongodb_parser.py +17 -25
  35. mindsdb/{api/mongo/utilities → integrations/handlers/mongodb_handler/utils}/mongodb_query.py +10 -16
  36. mindsdb/integrations/handlers/mongodb_handler/utils/mongodb_render.py +43 -69
  37. mindsdb/integrations/libs/base.py +1 -1
  38. mindsdb/interfaces/agents/constants.py +1 -0
  39. mindsdb/interfaces/knowledge_base/controller.py +3 -1
  40. mindsdb/utilities/config.py +3 -155
  41. mindsdb/utilities/log.py +0 -25
  42. mindsdb/utilities/starters.py +0 -39
  43. {mindsdb-25.8.3.0.dist-info → mindsdb-25.9.1.0.dist-info}/METADATA +263 -261
  44. {mindsdb-25.8.3.0.dist-info → mindsdb-25.9.1.0.dist-info}/RECORD +47 -91
  45. mindsdb/api/a2a/__main__.py +0 -144
  46. mindsdb/api/a2a/run_a2a.py +0 -86
  47. mindsdb/api/common/check_auth.py +0 -42
  48. mindsdb/api/http/gunicorn_wrapper.py +0 -17
  49. mindsdb/api/mcp/start.py +0 -205
  50. mindsdb/api/mongo/__init__.py +0 -0
  51. mindsdb/api/mongo/classes/__init__.py +0 -5
  52. mindsdb/api/mongo/classes/query_sql.py +0 -19
  53. mindsdb/api/mongo/classes/responder.py +0 -45
  54. mindsdb/api/mongo/classes/responder_collection.py +0 -34
  55. mindsdb/api/mongo/classes/scram.py +0 -86
  56. mindsdb/api/mongo/classes/session.py +0 -23
  57. mindsdb/api/mongo/functions/__init__.py +0 -19
  58. mindsdb/api/mongo/responders/__init__.py +0 -73
  59. mindsdb/api/mongo/responders/add_shard.py +0 -13
  60. mindsdb/api/mongo/responders/aggregate.py +0 -90
  61. mindsdb/api/mongo/responders/buildinfo.py +0 -17
  62. mindsdb/api/mongo/responders/coll_stats.py +0 -63
  63. mindsdb/api/mongo/responders/company_id.py +0 -25
  64. mindsdb/api/mongo/responders/connection_status.py +0 -22
  65. mindsdb/api/mongo/responders/count.py +0 -21
  66. mindsdb/api/mongo/responders/db_stats.py +0 -32
  67. mindsdb/api/mongo/responders/delete.py +0 -105
  68. mindsdb/api/mongo/responders/describe.py +0 -23
  69. mindsdb/api/mongo/responders/end_sessions.py +0 -13
  70. mindsdb/api/mongo/responders/find.py +0 -175
  71. mindsdb/api/mongo/responders/get_cmd_line_opts.py +0 -18
  72. mindsdb/api/mongo/responders/get_free_monitoring_status.py +0 -14
  73. mindsdb/api/mongo/responders/get_parameter.py +0 -23
  74. mindsdb/api/mongo/responders/getlog.py +0 -14
  75. mindsdb/api/mongo/responders/host_info.py +0 -28
  76. mindsdb/api/mongo/responders/insert.py +0 -270
  77. mindsdb/api/mongo/responders/is_master.py +0 -20
  78. mindsdb/api/mongo/responders/is_master_lower.py +0 -13
  79. mindsdb/api/mongo/responders/list_collections.py +0 -55
  80. mindsdb/api/mongo/responders/list_databases.py +0 -37
  81. mindsdb/api/mongo/responders/list_indexes.py +0 -22
  82. mindsdb/api/mongo/responders/ping.py +0 -13
  83. mindsdb/api/mongo/responders/recv_chunk_start.py +0 -13
  84. mindsdb/api/mongo/responders/replsetgetstatus.py +0 -13
  85. mindsdb/api/mongo/responders/sasl_continue.py +0 -34
  86. mindsdb/api/mongo/responders/sasl_start.py +0 -33
  87. mindsdb/api/mongo/responders/update_range_deletions.py +0 -12
  88. mindsdb/api/mongo/responders/whatsmyuri.py +0 -18
  89. mindsdb/api/mongo/server.py +0 -388
  90. mindsdb/api/mongo/start.py +0 -15
  91. mindsdb/api/mongo/utilities/__init__.py +0 -0
  92. {mindsdb-25.8.3.0.dist-info → mindsdb-25.9.1.0.dist-info}/WHEEL +0 -0
  93. {mindsdb-25.8.3.0.dist-info → mindsdb-25.9.1.0.dist-info}/licenses/LICENSE +0 -0
  94. {mindsdb-25.8.3.0.dist-info → mindsdb-25.9.1.0.dist-info}/top_level.txt +0 -0
@@ -29,7 +29,7 @@ from mindsdb.integrations.handlers.langchain_embedding_handler.langchain_embeddi
29
29
  construct_model_from_args,
30
30
  )
31
31
 
32
- from mindsdb.interfaces.agents.constants import DEFAULT_EMBEDDINGS_MODEL_CLASS
32
+ from mindsdb.interfaces.agents.constants import DEFAULT_EMBEDDINGS_MODEL_CLASS, MAX_INSERT_BATCH_SIZE
33
33
  from mindsdb.interfaces.agents.langchain_agent import create_chat_model, get_llm_provider
34
34
  from mindsdb.interfaces.database.projects import ProjectController
35
35
  from mindsdb.interfaces.variables.variables_controller import variables_controller
@@ -493,6 +493,8 @@ class KnowledgeBaseTable:
493
493
  """Process and insert raw data rows"""
494
494
  if not rows:
495
495
  return
496
+ if len(rows) > MAX_INSERT_BATCH_SIZE:
497
+ raise ValueError("Input data is too large, please load data in batches")
496
498
 
497
499
  df = pd.DataFrame(rows)
498
500
 
@@ -3,13 +3,14 @@ import sys
3
3
  import json
4
4
  import argparse
5
5
  import datetime
6
+ import logging
6
7
  from pathlib import Path
7
8
  from copy import deepcopy
8
- import multiprocessing as mp
9
9
 
10
10
  from appdirs import user_data_dir
11
11
 
12
12
  # NOTE do not `import from mindsdb` here
13
+ logger = logging.getLogger(__name__)
13
14
 
14
15
 
15
16
  def _merge_key_recursive(target_dict, source_dict, key):
@@ -171,14 +172,6 @@ class Config:
171
172
  "restart_on_failure": True,
172
173
  "max_restart_count": 1,
173
174
  "max_restart_interval_seconds": 60,
174
- "server": {
175
- "type": "waitress", # MINDSDB_HTTP_SERVER_TYPE MINDSDB_DEFAULT_SERVER
176
- "config": {
177
- "threads": 16,
178
- "max_request_body_size": (1 << 30) * 10, # 10GB
179
- "inbuf_overflow": (1 << 30) * 10,
180
- },
181
- },
182
175
  },
183
176
  "mysql": {
184
177
  "host": api_host,
@@ -189,29 +182,11 @@ class Config:
189
182
  "max_restart_count": 1,
190
183
  "max_restart_interval_seconds": 60,
191
184
  },
192
- "mongodb": {"host": api_host, "port": "47336", "database": "mindsdb"},
193
185
  "postgres": {"host": api_host, "port": "55432", "database": "mindsdb"},
194
- "mcp": {
195
- "host": api_host,
196
- "port": "47337",
197
- "enabled": True,
198
- "restart_on_failure": True,
199
- "max_restart_count": 1,
200
- "max_restart_interval_seconds": 60,
201
- },
202
186
  "litellm": {
203
187
  "host": "0.0.0.0", # API server binds to all interfaces by default
204
188
  "port": "8000",
205
189
  },
206
- "a2a": {
207
- "host": api_host,
208
- "port": 47338,
209
- "mindsdb_host": "localhost",
210
- "mindsdb_port": 47334,
211
- "agent_name": "my_agent",
212
- "project_name": "mindsdb",
213
- "enabled": False,
214
- },
215
190
  },
216
191
  "cache": {"type": "local"},
217
192
  "ml_task_queue": {"type": "local"},
@@ -250,7 +225,7 @@ class Config:
250
225
  """Collect config values from env vars to self._env_config"""
251
226
  self._env_config = {
252
227
  "logging": {"handlers": {"console": {}, "file": {}}},
253
- "api": {"http": {"server": {}}, "a2a": {}},
228
+ "api": {"http": {}},
254
229
  "auth": {},
255
230
  "paths": {},
256
231
  "permanent_storage": {},
@@ -298,21 +273,6 @@ class Config:
298
273
  self._env_config["auth"]["password"] = http_password
299
274
  # endregion
300
275
 
301
- # region permanent session lifetime
302
- for env_name in (
303
- "MINDSDB_HTTP_PERMANENT_SESSION_LIFETIME",
304
- "FLASK_PERMANENT_SESSION_LIFETIME",
305
- ):
306
- env_value = os.environ.get(env_name)
307
- if isinstance(env_value, str):
308
- try:
309
- permanent_session_lifetime = int(env_value)
310
- except Exception:
311
- raise ValueError(f"Warning: Can't cast env var {env_name} value to int: {env_value}")
312
- self._env_config["auth"]["http_permanent_session_lifetime"] = permanent_session_lifetime
313
- break
314
- # endregion
315
-
316
276
  # region logging
317
277
  if os.environ.get("MINDSDB_LOG_LEVEL", "") != "":
318
278
  self._env_config["logging"]["handlers"]["console"]["level"] = os.environ["MINDSDB_LOG_LEVEL"]
@@ -325,35 +285,6 @@ class Config:
325
285
  self._env_config["logging"]["handlers"]["file"]["enabled"] = True
326
286
  # endregion
327
287
 
328
- # region server type
329
- server_type = os.environ.get("MINDSDB_HTTP_SERVER_TYPE", "").lower()
330
- if server_type == "":
331
- server_type = os.environ.get("MINDSDB_DEFAULT_SERVER", "").lower()
332
- if server_type != "":
333
- if server_type == "waitress":
334
- self._env_config["api"]["http"]["server"]["type"] = "waitress"
335
- self._default_config["api"]["http"]["server"]["config"] = {}
336
- self._env_config["api"]["http"]["server"]["config"] = {
337
- "threads": 16,
338
- "max_request_body_size": (1 << 30) * 10, # 10GB
339
- "inbuf_overflow": (1 << 30) * 10,
340
- }
341
- elif server_type == "flask":
342
- self._env_config["api"]["http"]["server"]["type"] = "flask"
343
- self._default_config["api"]["http"]["server"]["config"] = {}
344
- self._env_config["api"]["http"]["server"]["config"] = {}
345
- elif server_type == "gunicorn":
346
- self._env_config["api"]["http"]["server"]["type"] = "gunicorn"
347
- self._default_config["api"]["http"]["server"]["config"] = {}
348
- self._env_config["api"]["http"]["server"]["config"] = {
349
- "workers": min(mp.cpu_count(), 4),
350
- "timeout": 600,
351
- "reuse_port": True,
352
- "preload_app": True,
353
- "threads": 4,
354
- }
355
- # endregion
356
-
357
288
  if os.environ.get("MINDSDB_DB_CON", "") != "":
358
289
  self._env_config["storage_db"] = os.environ["MINDSDB_DB_CON"]
359
290
 
@@ -373,32 +304,6 @@ class Config:
373
304
  if os.environ.get("MINDSDB_DATA_CATALOG_ENABLED", "").lower() in ("1", "true"):
374
305
  self._env_config["data_catalog"] = {"enabled": True}
375
306
 
376
- # region vars: a2a configuration
377
- a2a_config = {}
378
- if os.environ.get("MINDSDB_A2A_HOST"):
379
- a2a_config["host"] = os.environ.get("MINDSDB_A2A_HOST")
380
- if os.environ.get("MINDSDB_A2A_PORT"):
381
- a2a_config["port"] = int(os.environ.get("MINDSDB_A2A_PORT"))
382
- if os.environ.get("MINDSDB_HOST"):
383
- a2a_config["mindsdb_host"] = os.environ.get("MINDSDB_HOST")
384
- if os.environ.get("MINDSDB_PORT"):
385
- a2a_config["mindsdb_port"] = int(os.environ.get("MINDSDB_PORT"))
386
- if os.environ.get("MINDSDB_AGENT_NAME"):
387
- a2a_config["agent_name"] = os.environ.get("MINDSDB_AGENT_NAME")
388
- if os.environ.get("MINDSDB_PROJECT_NAME"):
389
- a2a_config["project_name"] = os.environ.get("MINDSDB_PROJECT_NAME")
390
- if os.environ.get("MINDSDB_A2A_ENABLED") is not None:
391
- a2a_config["enabled"] = os.environ.get("MINDSDB_A2A_ENABLED").lower() in (
392
- "true",
393
- "1",
394
- "yes",
395
- "y",
396
- )
397
-
398
- if a2a_config:
399
- self._env_config["api"]["a2a"] = a2a_config
400
- # endregion
401
-
402
307
  def fetch_auto_config(self) -> bool:
403
308
  """Load dict readed from config.auto.json to `auto_config`.
404
309
  Do it only if `auto_config` was not loaded before or config.auto.json been changed.
@@ -462,38 +367,6 @@ class Config:
462
367
  _merge_configs(new_config, self._auto_config or {})
463
368
  _merge_configs(new_config, self._env_config or {})
464
369
 
465
- # Apply command-line arguments for A2A
466
- a2a_config = {}
467
-
468
- # Check for A2A command-line arguments
469
- if hasattr(self.cmd_args, "a2a_host") and self.cmd_args.a2a_host is not None:
470
- a2a_config["host"] = self.cmd_args.a2a_host
471
-
472
- if hasattr(self.cmd_args, "a2a_port") and self.cmd_args.a2a_port is not None:
473
- a2a_config["port"] = self.cmd_args.a2a_port
474
-
475
- if hasattr(self.cmd_args, "mindsdb_host") and self.cmd_args.mindsdb_host is not None:
476
- a2a_config["mindsdb_host"] = self.cmd_args.mindsdb_host
477
-
478
- if hasattr(self.cmd_args, "mindsdb_port") and self.cmd_args.mindsdb_port is not None:
479
- a2a_config["mindsdb_port"] = self.cmd_args.mindsdb_port
480
-
481
- if hasattr(self.cmd_args, "agent_name") and self.cmd_args.agent_name is not None:
482
- a2a_config["agent_name"] = self.cmd_args.agent_name
483
-
484
- if hasattr(self.cmd_args, "project_name") and self.cmd_args.project_name is not None:
485
- a2a_config["project_name"] = self.cmd_args.project_name
486
-
487
- # Merge command-line args config with highest priority
488
- if a2a_config:
489
- _merge_configs(new_config, {"api": {"a2a": a2a_config}})
490
-
491
- # Ensure A2A port is never 0, which would prevent the A2A API from starting
492
- a2a_config = new_config["api"].get("a2a")
493
- if a2a_config is not None and isinstance(a2a_config, dict):
494
- if "port" in a2a_config and (a2a_config["port"] == 0 or a2a_config["port"] is None):
495
- a2a_config["port"] = 47338 # Use the default port value
496
-
497
370
  # region create dirs
498
371
  for key, value in new_config["paths"].items():
499
372
  if isinstance(value, str):
@@ -550,12 +423,6 @@ class Config:
550
423
  if "log" in self._config:
551
424
  logger.warning("The 'log' config option is no longer supported. Use 'logging' instead.")
552
425
 
553
- if os.environ.get("MINDSDB_DEFAULT_SERVER", "") != "":
554
- logger.warning(
555
- "Env variable 'MINDSDB_DEFAULT_SERVER' is going to be deprecated soon. "
556
- "Use 'MINDSDB_HTTP_SERVER_TYPE' instead."
557
- )
558
-
559
426
  file_upload_domains = self._config.get("file_upload_domains")
560
427
  if isinstance(file_upload_domains, list) and len(file_upload_domains) > 0:
561
428
  allowed_origins = self._config["url_file_upload"]["allowed_origins"]
@@ -566,14 +433,6 @@ class Config:
566
433
  'use config["url_file_upload"]["allowed_origins"] instead.'
567
434
  )
568
435
 
569
- for env_name in ("MINDSDB_HTTP_SERVER_TYPE", "MINDSDB_DEFAULT_SERVER"):
570
- env_value = os.environ.get(env_name, "")
571
- if env_value.lower() not in ("waitress", "flask", "gunicorn", ""):
572
- logger.warning(
573
- f"The value '{env_value}' of the environment variable {env_name} is not valid. "
574
- "It must be one of the following: 'waitress', 'flask', or 'gunicorn'."
575
- )
576
-
577
436
  @property
578
437
  def cmd_args(self):
579
438
  if self._cmd_args is None:
@@ -624,17 +483,6 @@ class Config:
624
483
  help="Project containing the agent (default: mindsdb)",
625
484
  )
626
485
 
627
- # A2A specific arguments
628
- parser.add_argument("--a2a-host", type=str, default=None, help="A2A server host")
629
- parser.add_argument("--a2a-port", type=int, default=None, help="A2A server port")
630
- parser.add_argument("--mindsdb-host", type=str, default=None, help="MindsDB server host")
631
- parser.add_argument("--mindsdb-port", type=int, default=None, help="MindsDB server port")
632
- parser.add_argument(
633
- "--agent-name",
634
- type=str,
635
- default=None,
636
- help="MindsDB agent name to connect to",
637
- )
638
486
  parser.add_argument("--project-name", type=str, default=None, help="MindsDB project name")
639
487
  parser.add_argument("--update-gui", action="store_true", default=False, help="Update GUI and exit")
640
488
 
mindsdb/utilities/log.py CHANGED
@@ -99,31 +99,6 @@ def get_handlers_config(process_name: str) -> dict:
99
99
  return handlers_config
100
100
 
101
101
 
102
- def get_uvicorn_logging_config(process_name: str) -> dict:
103
- """Generate a logging configuration dictionary for Uvicorn using MindsDB's logging settings.
104
-
105
- Args:
106
- process_name (str): The name of the process to include in log file names and handlers.
107
-
108
- Returns:
109
- dict: A dictionary suitable for use with logging.config.dictConfig, configured for Uvicorn logging.
110
- """
111
- handlers_config = get_handlers_config(process_name)
112
- mindsdb_log_level = get_mindsdb_log_level()
113
- return {
114
- "version": 1,
115
- "formatters": FORMATTERS,
116
- "handlers": handlers_config,
117
- "loggers": {
118
- "uvicorn": {
119
- "handlers": list(handlers_config.keys()),
120
- "level": mindsdb_log_level,
121
- "propagate": False,
122
- }
123
- },
124
- }
125
-
126
-
127
102
  def configure_logging(process_name: str = None):
128
103
  handlers_config = get_handlers_config(process_name)
129
104
  mindsdb_log_level = get_mindsdb_log_level()
@@ -18,16 +18,6 @@ def start_mysql(*args, **kwargs):
18
18
  start(*args, **kwargs)
19
19
 
20
20
 
21
- def start_mongo(*args, **kwargs):
22
- from mindsdb.utilities.log import initialize_logging
23
-
24
- initialize_logging("mongo")
25
-
26
- from mindsdb.api.mongo.start import start
27
-
28
- start(*args, **kwargs)
29
-
30
-
31
21
  def start_postgres(*args, **kwargs):
32
22
  from mindsdb.utilities.log import initialize_logging
33
23
 
@@ -68,17 +58,6 @@ def start_scheduler(*args, **kwargs):
68
58
  start(*args, **kwargs)
69
59
 
70
60
 
71
- def start_mcp(*args, **kwargs):
72
- """Start the MCP server"""
73
- from mindsdb.utilities.log import initialize_logging
74
-
75
- initialize_logging("mcp")
76
-
77
- from mindsdb.api.mcp.start import start
78
-
79
- start(*args, **kwargs)
80
-
81
-
82
61
  def start_litellm(*args, **kwargs):
83
62
  """Start the LiteLLM server"""
84
63
  from mindsdb.utilities.log import initialize_logging
@@ -88,21 +67,3 @@ def start_litellm(*args, **kwargs):
88
67
  from mindsdb.api.litellm.start import start
89
68
 
90
69
  start(*args, **kwargs)
91
-
92
-
93
- def start_a2a(*args, **kwargs):
94
- """Start the A2A server as a subprocess of the main MindsDB process"""
95
- from mindsdb.utilities.log import initialize_logging
96
-
97
- initialize_logging("a2a")
98
-
99
- from mindsdb.api.a2a.run_a2a import main
100
-
101
- # Extract configuration from the global config
102
- from mindsdb.utilities.config import Config
103
-
104
- config = Config()
105
- a2a_config = config.get("api", {}).get("a2a", {})
106
-
107
- # Pass configuration to the A2A main function
108
- main(a2a_config, *args, **kwargs)