MindsDB 25.9.1.2__py3-none-any.whl → 25.9.3rc1__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 (120) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +39 -20
  3. mindsdb/api/a2a/agent.py +7 -9
  4. mindsdb/api/a2a/common/server/server.py +3 -3
  5. mindsdb/api/a2a/common/server/task_manager.py +4 -4
  6. mindsdb/api/a2a/task_manager.py +15 -17
  7. mindsdb/api/common/middleware.py +9 -11
  8. mindsdb/api/executor/command_executor.py +2 -4
  9. mindsdb/api/executor/datahub/datanodes/datanode.py +2 -2
  10. mindsdb/api/executor/datahub/datanodes/integration_datanode.py +100 -48
  11. mindsdb/api/executor/datahub/datanodes/project_datanode.py +8 -4
  12. mindsdb/api/executor/datahub/datanodes/system_tables.py +1 -1
  13. mindsdb/api/executor/exceptions.py +29 -10
  14. mindsdb/api/executor/planner/plan_join.py +17 -3
  15. mindsdb/api/executor/sql_query/sql_query.py +74 -74
  16. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +1 -2
  17. mindsdb/api/executor/sql_query/steps/subselect_step.py +0 -1
  18. mindsdb/api/executor/utilities/functions.py +6 -6
  19. mindsdb/api/executor/utilities/sql.py +32 -16
  20. mindsdb/api/http/gui.py +5 -11
  21. mindsdb/api/http/initialize.py +8 -10
  22. mindsdb/api/http/namespaces/agents.py +10 -12
  23. mindsdb/api/http/namespaces/analysis.py +13 -20
  24. mindsdb/api/http/namespaces/auth.py +1 -1
  25. mindsdb/api/http/namespaces/config.py +15 -11
  26. mindsdb/api/http/namespaces/databases.py +140 -201
  27. mindsdb/api/http/namespaces/file.py +15 -4
  28. mindsdb/api/http/namespaces/handlers.py +7 -2
  29. mindsdb/api/http/namespaces/knowledge_bases.py +8 -7
  30. mindsdb/api/http/namespaces/models.py +94 -126
  31. mindsdb/api/http/namespaces/projects.py +13 -22
  32. mindsdb/api/http/namespaces/sql.py +33 -25
  33. mindsdb/api/http/namespaces/tab.py +27 -37
  34. mindsdb/api/http/namespaces/views.py +1 -1
  35. mindsdb/api/http/start.py +14 -8
  36. mindsdb/api/mcp/__init__.py +2 -1
  37. mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +15 -20
  38. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +26 -50
  39. mindsdb/api/mysql/mysql_proxy/utilities/__init__.py +0 -1
  40. mindsdb/api/postgres/postgres_proxy/executor/executor.py +6 -13
  41. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_packets.py +40 -28
  42. mindsdb/integrations/handlers/byom_handler/byom_handler.py +168 -185
  43. mindsdb/integrations/handlers/chromadb_handler/chromadb_handler.py +11 -5
  44. mindsdb/integrations/handlers/file_handler/file_handler.py +7 -0
  45. mindsdb/integrations/handlers/lightwood_handler/functions.py +45 -79
  46. mindsdb/integrations/handlers/openai_handler/openai_handler.py +1 -1
  47. mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py +20 -2
  48. mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +18 -3
  49. mindsdb/integrations/handlers/shopify_handler/shopify_handler.py +25 -12
  50. mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +2 -1
  51. mindsdb/integrations/handlers/statsforecast_handler/requirements.txt +1 -0
  52. mindsdb/integrations/handlers/statsforecast_handler/requirements_extra.txt +1 -0
  53. mindsdb/integrations/handlers/web_handler/urlcrawl_helpers.py +4 -4
  54. mindsdb/integrations/libs/api_handler.py +10 -10
  55. mindsdb/integrations/libs/base.py +4 -4
  56. mindsdb/integrations/libs/llm/utils.py +2 -2
  57. mindsdb/integrations/libs/ml_handler_process/create_engine_process.py +4 -7
  58. mindsdb/integrations/libs/ml_handler_process/func_call_process.py +2 -7
  59. mindsdb/integrations/libs/ml_handler_process/learn_process.py +37 -47
  60. mindsdb/integrations/libs/ml_handler_process/update_engine_process.py +4 -7
  61. mindsdb/integrations/libs/ml_handler_process/update_process.py +2 -7
  62. mindsdb/integrations/libs/process_cache.py +132 -140
  63. mindsdb/integrations/libs/response.py +18 -12
  64. mindsdb/integrations/libs/vectordatabase_handler.py +26 -0
  65. mindsdb/integrations/utilities/files/file_reader.py +6 -7
  66. mindsdb/integrations/utilities/rag/config_loader.py +37 -26
  67. mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +59 -9
  68. mindsdb/integrations/utilities/rag/rerankers/reranker_compressor.py +4 -4
  69. mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py +55 -133
  70. mindsdb/integrations/utilities/rag/settings.py +58 -133
  71. mindsdb/integrations/utilities/rag/splitters/file_splitter.py +5 -15
  72. mindsdb/interfaces/agents/agents_controller.py +2 -1
  73. mindsdb/interfaces/agents/constants.py +0 -2
  74. mindsdb/interfaces/agents/litellm_server.py +34 -58
  75. mindsdb/interfaces/agents/mcp_client_agent.py +10 -10
  76. mindsdb/interfaces/agents/mindsdb_database_agent.py +5 -5
  77. mindsdb/interfaces/agents/run_mcp_agent.py +12 -21
  78. mindsdb/interfaces/chatbot/chatbot_task.py +20 -23
  79. mindsdb/interfaces/chatbot/polling.py +30 -18
  80. mindsdb/interfaces/data_catalog/data_catalog_loader.py +10 -10
  81. mindsdb/interfaces/database/integrations.py +19 -2
  82. mindsdb/interfaces/file/file_controller.py +6 -6
  83. mindsdb/interfaces/functions/controller.py +1 -1
  84. mindsdb/interfaces/functions/to_markdown.py +2 -2
  85. mindsdb/interfaces/jobs/jobs_controller.py +5 -5
  86. mindsdb/interfaces/jobs/scheduler.py +3 -8
  87. mindsdb/interfaces/knowledge_base/controller.py +54 -25
  88. mindsdb/interfaces/knowledge_base/preprocessing/json_chunker.py +40 -61
  89. mindsdb/interfaces/model/model_controller.py +170 -166
  90. mindsdb/interfaces/query_context/context_controller.py +14 -2
  91. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +6 -4
  92. mindsdb/interfaces/skills/retrieval_tool.py +43 -50
  93. mindsdb/interfaces/skills/skill_tool.py +2 -2
  94. mindsdb/interfaces/skills/sql_agent.py +25 -19
  95. mindsdb/interfaces/storage/fs.py +114 -169
  96. mindsdb/interfaces/storage/json.py +19 -18
  97. mindsdb/interfaces/storage/model_fs.py +54 -92
  98. mindsdb/interfaces/tabs/tabs_controller.py +49 -72
  99. mindsdb/interfaces/tasks/task_monitor.py +3 -9
  100. mindsdb/interfaces/tasks/task_thread.py +7 -9
  101. mindsdb/interfaces/triggers/trigger_task.py +7 -13
  102. mindsdb/interfaces/triggers/triggers_controller.py +47 -50
  103. mindsdb/migrations/migrate.py +16 -16
  104. mindsdb/utilities/api_status.py +58 -0
  105. mindsdb/utilities/config.py +49 -0
  106. mindsdb/utilities/exception.py +40 -1
  107. mindsdb/utilities/fs.py +0 -1
  108. mindsdb/utilities/hooks/profiling.py +17 -14
  109. mindsdb/utilities/langfuse.py +40 -45
  110. mindsdb/utilities/log.py +272 -0
  111. mindsdb/utilities/ml_task_queue/consumer.py +52 -58
  112. mindsdb/utilities/ml_task_queue/producer.py +26 -30
  113. mindsdb/utilities/render/sqlalchemy_render.py +8 -7
  114. mindsdb/utilities/utils.py +2 -2
  115. {mindsdb-25.9.1.2.dist-info → mindsdb-25.9.3rc1.dist-info}/METADATA +266 -261
  116. {mindsdb-25.9.1.2.dist-info → mindsdb-25.9.3rc1.dist-info}/RECORD +119 -119
  117. mindsdb/api/mysql/mysql_proxy/utilities/exceptions.py +0 -14
  118. {mindsdb-25.9.1.2.dist-info → mindsdb-25.9.3rc1.dist-info}/WHEEL +0 -0
  119. {mindsdb-25.9.1.2.dist-info → mindsdb-25.9.3rc1.dist-info}/licenses/LICENSE +0 -0
  120. {mindsdb-25.9.1.2.dist-info → mindsdb-25.9.3rc1.dist-info}/top_level.txt +0 -0
@@ -8,11 +8,7 @@ from mindsdb.utilities.config import Config
8
8
  from mindsdb.utilities.ml_task_queue.utils import RedisKey, to_bytes
9
9
  from mindsdb.utilities.ml_task_queue.task import Task
10
10
  from mindsdb.utilities.ml_task_queue.base import BaseRedisQueue
11
- from mindsdb.utilities.ml_task_queue.const import (
12
- TASKS_STREAM_NAME,
13
- ML_TASK_TYPE,
14
- ML_TASK_STATUS
15
- )
11
+ from mindsdb.utilities.ml_task_queue.const import TASKS_STREAM_NAME, ML_TASK_TYPE, ML_TASK_STATUS
16
12
  from mindsdb.utilities import log
17
13
  from mindsdb.utilities.sentry import sentry_sdk # noqa: F401
18
14
 
@@ -20,25 +16,25 @@ logger = log.getLogger(__name__)
20
16
 
21
17
 
22
18
  class MLTaskProducer(BaseRedisQueue):
23
- """ Interface around the redis for putting tasks to the queue
19
+ """Interface around the redis for putting tasks to the queue
24
20
 
25
- Attributes:
26
- db (Redis): database object
27
- stream
28
- cache
29
- pubsub
21
+ Attributes:
22
+ db (Redis): database object
23
+ stream
24
+ cache
25
+ pubsub
30
26
  """
31
27
 
32
28
  def __init__(self) -> None:
33
- config = Config().get('ml_task_queue', {})
29
+ config = Config().get("ml_task_queue", {})
34
30
 
35
31
  self.db = Database(
36
- host=config.get('host', 'localhost'),
37
- port=config.get('port', 6379),
38
- db=config.get('db', 0),
39
- username=config.get('username'),
40
- password=config.get('password'),
41
- protocol=3
32
+ host=config.get("host", "localhost"),
33
+ port=config.get("port", 6379),
34
+ db=config.get("db", 0),
35
+ username=config.get("username"),
36
+ password=config.get("password"),
37
+ protocol=3,
42
38
  )
43
39
  self.wait_redis_ping(60)
44
40
 
@@ -47,26 +43,26 @@ class MLTaskProducer(BaseRedisQueue):
47
43
  self.pubsub = self.db.pubsub()
48
44
 
49
45
  def apply_async(self, task_type: ML_TASK_TYPE, model_id: int, payload: dict, dataframe: DataFrame = None) -> Task:
50
- ''' Add tasks to the queue
46
+ """Add tasks to the queue
51
47
 
52
- Args:
53
- task_type (ML_TASK_TYPE): type of the task
54
- model_id (int): model identifier
55
- payload (dict): lightweight model data that will be added to stream message
56
- dataframe (DataFrame): dataframe will be transfered via regular redis storage
48
+ Args:
49
+ task_type (ML_TASK_TYPE): type of the task
50
+ model_id (int): model identifier
51
+ payload (dict): lightweight model data that will be added to stream message
52
+ dataframe (DataFrame): dataframe will be transfered via regular redis storage
57
53
 
58
- Returns:
59
- Task: object representing the task
60
- '''
54
+ Returns:
55
+ Task: object representing the task
56
+ """
61
57
  try:
62
58
  payload = pickle.dumps(payload, protocol=5)
63
59
  redis_key = RedisKey.new()
64
60
  message = {
65
61
  "task_type": task_type.value,
66
- "company_id": '' if ctx.company_id is None else ctx.company_id, # None can not be dumped
62
+ "company_id": "" if ctx.company_id is None else ctx.company_id, # None can not be dumped
67
63
  "model_id": model_id,
68
64
  "payload": payload,
69
- "redis_key": redis_key.base
65
+ "redis_key": redis_key.base,
70
66
  }
71
67
 
72
68
  self.wait_redis_ping()
@@ -77,5 +73,5 @@ class MLTaskProducer(BaseRedisQueue):
77
73
  self.stream.add(message)
78
74
  return Task(self.db, redis_key)
79
75
  except ConnectionError:
80
- logger.error('Cant send message to redis: connect failed')
76
+ logger.exception("Cant send message to redis: connect failed")
81
77
  raise
@@ -47,7 +47,7 @@ def _compile_interval(element, compiler, **kw):
47
47
  if items[1].upper().endswith("S"):
48
48
  items[1] = items[1][:-1]
49
49
 
50
- if compiler.dialect.driver in ["snowflake"] or compiler.dialect.name in ["postgresql"]:
50
+ if getattr(compiler.dialect, "driver", None) == "snowflake" or compiler.dialect.name == "postgresql":
51
51
  # quote all
52
52
  args = " ".join(map(str, items))
53
53
  args = f"'{args}'"
@@ -383,7 +383,7 @@ class SqlalchemyRender:
383
383
  elif isinstance(t, ast.Parameter):
384
384
  col = sa.column(t.value, is_literal=True)
385
385
  if t.alias:
386
- raise RenderError()
386
+ raise RenderError("Parameter aliases are not supported in the renderer")
387
387
  elif isinstance(t, ast.Tuple):
388
388
  col = [self.to_expression(i) for i in t.items]
389
389
  elif isinstance(t, ast.Variable):
@@ -574,17 +574,18 @@ class SqlalchemyRender:
574
574
  else:
575
575
  condition = self.to_expression(item["condition"])
576
576
 
577
- if "ASOF" in join_type:
577
+ if "ASOF" in join_type or "RIGHT" in join_type:
578
578
  raise NotImplementedError(f"Unsupported join type: {join_type}")
579
- method = "join"
579
+
580
580
  is_full = False
581
- if join_type == "LEFT JOIN":
582
- method = "outerjoin"
581
+ is_outer = False
582
+ if join_type in ("LEFT JOIN", "LEFT OUTER JOIN"):
583
+ is_outer = True
583
584
  if join_type == "FULL JOIN":
584
585
  is_full = True
585
586
 
586
587
  # perform join
587
- query = getattr(query, method)(table, condition, full=is_full)
588
+ query = query.join(table, condition, isouter=is_outer, full=is_full)
588
589
  elif isinstance(from_table, (ast.Union, ast.Intersect, ast.Except)):
589
590
  alias = None
590
591
  if from_table.alias:
@@ -22,13 +22,13 @@ def parse_csv_attributes(csv_attributes: typing.Optional[str] = "") -> typing.Di
22
22
  for row in reader:
23
23
  for pair in row:
24
24
  # Match key=value pattern
25
- match = re.match(r'^\s*([^=]+?)\s*=\s*(.+?)\s*$', pair)
25
+ match = re.match(r"^\s*([^=]+?)\s*=\s*(.+?)\s*$", pair)
26
26
  if match:
27
27
  key, value = match.groups()
28
28
  attributes[key.strip()] = value.strip()
29
29
  else:
30
30
  raise ValueError(f"Invalid attribute format: {pair}")
31
31
  except Exception as e:
32
- raise ValueError(f"Failed to parse csv_attributes='{csv_attributes}': {e}")
32
+ raise ValueError(f"Failed to parse csv_attributes='{csv_attributes}': {e}") from e
33
33
 
34
34
  return attributes