MindsDB 25.2.3.0__py3-none-any.whl → 25.3.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.
- mindsdb/__about__.py +1 -1
- mindsdb/__main__.py +16 -11
- mindsdb/api/executor/command_executor.py +1 -1
- mindsdb/api/executor/datahub/datanodes/system_tables.py +10 -2
- mindsdb/api/executor/planner/query_planner.py +6 -2
- mindsdb/api/executor/sql_query/steps/prepare_steps.py +2 -1
- mindsdb/api/http/initialize.py +8 -5
- mindsdb/api/http/namespaces/agents.py +0 -7
- mindsdb/api/http/namespaces/config.py +0 -48
- mindsdb/api/http/namespaces/knowledge_bases.py +1 -1
- mindsdb/api/http/namespaces/util.py +0 -28
- mindsdb/api/mongo/classes/query_sql.py +2 -1
- mindsdb/api/mongo/responders/aggregate.py +2 -2
- mindsdb/api/mongo/responders/coll_stats.py +3 -2
- mindsdb/api/mongo/responders/db_stats.py +2 -1
- mindsdb/api/mongo/responders/insert.py +4 -2
- mindsdb/api/mysql/mysql_proxy/classes/fake_mysql_proxy/fake_mysql_proxy.py +2 -1
- mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +5 -4
- mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +2 -4
- mindsdb/integrations/handlers/anyscale_endpoints_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/autosklearn_handler/autosklearn_handler.py +1 -1
- mindsdb/integrations/handlers/dspy_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/gmail_handler/connection_args.py +2 -2
- mindsdb/integrations/handlers/gmail_handler/gmail_handler.py +19 -66
- mindsdb/integrations/handlers/gmail_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/google_calendar_handler/connection_args.py +15 -0
- mindsdb/integrations/handlers/google_calendar_handler/google_calendar_handler.py +31 -41
- mindsdb/integrations/handlers/google_calendar_handler/requirements.txt +0 -2
- mindsdb/integrations/handlers/langchain_embedding_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/langchain_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/llama_index_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/openai_handler/constants.py +3 -1
- mindsdb/integrations/handlers/openai_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/rag_handler/requirements.txt +0 -1
- mindsdb/integrations/handlers/ray_serve_handler/ray_serve_handler.py +33 -8
- mindsdb/integrations/handlers/web_handler/urlcrawl_helpers.py +3 -2
- mindsdb/integrations/handlers/web_handler/web_handler.py +42 -33
- mindsdb/integrations/handlers/youtube_handler/__init__.py +2 -0
- mindsdb/integrations/handlers/youtube_handler/connection_args.py +32 -0
- mindsdb/integrations/handlers/youtube_handler/youtube_handler.py +2 -38
- mindsdb/integrations/libs/llm/utils.py +7 -1
- mindsdb/integrations/libs/process_cache.py +2 -2
- mindsdb/integrations/utilities/handlers/auth_utilities/google/google_user_oauth_utilities.py +29 -38
- mindsdb/integrations/utilities/pydantic_utils.py +208 -0
- mindsdb/integrations/utilities/rag/chains/local_context_summarizer_chain.py +227 -0
- mindsdb/integrations/utilities/rag/pipelines/rag.py +11 -4
- mindsdb/integrations/utilities/rag/retrievers/sql_retriever.py +800 -135
- mindsdb/integrations/utilities/rag/settings.py +390 -152
- mindsdb/integrations/utilities/sql_utils.py +2 -1
- mindsdb/interfaces/agents/agents_controller.py +14 -10
- mindsdb/interfaces/agents/callback_handlers.py +52 -5
- mindsdb/interfaces/agents/langchain_agent.py +5 -3
- mindsdb/interfaces/agents/mindsdb_chat_model.py +4 -2
- mindsdb/interfaces/chatbot/chatbot_controller.py +9 -8
- mindsdb/interfaces/database/database.py +3 -2
- mindsdb/interfaces/database/integrations.py +1 -1
- mindsdb/interfaces/database/projects.py +28 -2
- mindsdb/interfaces/jobs/jobs_controller.py +4 -1
- mindsdb/interfaces/jobs/scheduler.py +1 -1
- mindsdb/interfaces/knowledge_base/preprocessing/constants.py +2 -2
- mindsdb/interfaces/model/model_controller.py +5 -2
- mindsdb/interfaces/skills/retrieval_tool.py +128 -39
- mindsdb/interfaces/skills/skill_tool.py +7 -7
- mindsdb/interfaces/skills/skills_controller.py +10 -6
- mindsdb/interfaces/skills/sql_agent.py +6 -1
- mindsdb/interfaces/storage/db.py +14 -12
- mindsdb/interfaces/storage/json.py +59 -0
- mindsdb/interfaces/storage/model_fs.py +85 -3
- mindsdb/interfaces/triggers/triggers_controller.py +2 -1
- mindsdb/migrations/versions/2022-10-14_43c52d23845a_projects.py +17 -3
- mindsdb/migrations/versions/2025-02-10_6ab9903fc59a_del_log_table.py +33 -0
- mindsdb/migrations/versions/2025-02-14_4521dafe89ab_added_encrypted_content_to_json_storage.py +29 -0
- mindsdb/migrations/versions/2025-02-19_11347c213b36_added_metadata_to_projects.py +41 -0
- mindsdb/utilities/config.py +6 -1
- mindsdb/utilities/functions.py +11 -0
- mindsdb/utilities/log.py +17 -2
- mindsdb/utilities/ml_task_queue/consumer.py +4 -2
- mindsdb/utilities/render/sqlalchemy_render.py +4 -0
- {MindsDB-25.2.3.0.dist-info → mindsdb-25.3.1.0.dist-info}/METADATA +226 -247
- {MindsDB-25.2.3.0.dist-info → mindsdb-25.3.1.0.dist-info}/RECORD +83 -80
- {MindsDB-25.2.3.0.dist-info → mindsdb-25.3.1.0.dist-info}/WHEEL +1 -1
- mindsdb/integrations/handlers/gmail_handler/utils.py +0 -45
- mindsdb/utilities/log_controller.py +0 -39
- mindsdb/utilities/telemetry.py +0 -44
- {MindsDB-25.2.3.0.dist-info → mindsdb-25.3.1.0.dist-info}/LICENSE +0 -0
- {MindsDB-25.2.3.0.dist-info → mindsdb-25.3.1.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""del_log_table
|
|
2
|
+
|
|
3
|
+
Revision ID: 6ab9903fc59a
|
|
4
|
+
Revises: 4943359e354a
|
|
5
|
+
Create Date: 2025-02-10 16:50:27.186697
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from alembic import op
|
|
9
|
+
import sqlalchemy as sa
|
|
10
|
+
import mindsdb.interfaces.storage.db # noqa
|
|
11
|
+
|
|
12
|
+
# revision identifiers, used by Alembic.
|
|
13
|
+
revision = '6ab9903fc59a'
|
|
14
|
+
down_revision = '4943359e354a'
|
|
15
|
+
branch_labels = None
|
|
16
|
+
depends_on = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def upgrade():
|
|
20
|
+
op.drop_table('log')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def downgrade():
|
|
24
|
+
op.create_table(
|
|
25
|
+
'log',
|
|
26
|
+
sa.Column('id', sa.INTEGER(), nullable=False),
|
|
27
|
+
sa.Column('created_at', sa.DATETIME(), nullable=True),
|
|
28
|
+
sa.Column('log_type', sa.VARCHAR(), nullable=True),
|
|
29
|
+
sa.Column('source', sa.VARCHAR(), nullable=True),
|
|
30
|
+
sa.Column('company_id', sa.INTEGER(), nullable=True),
|
|
31
|
+
sa.Column('payload', sa.VARCHAR(), nullable=True),
|
|
32
|
+
sa.PrimaryKeyConstraint('id')
|
|
33
|
+
)
|
mindsdb/migrations/versions/2025-02-14_4521dafe89ab_added_encrypted_content_to_json_storage.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""added_encrypted_content_to_json_storage
|
|
2
|
+
|
|
3
|
+
Revision ID: 4521dafe89ab
|
|
4
|
+
Revises: 6ab9903fc59a
|
|
5
|
+
Create Date: 2025-02-14 12:05:13.102594
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from alembic import op
|
|
9
|
+
import sqlalchemy as sa
|
|
10
|
+
import mindsdb.interfaces.storage.db # noqa
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision = '4521dafe89ab'
|
|
15
|
+
down_revision = '6ab9903fc59a'
|
|
16
|
+
branch_labels = None
|
|
17
|
+
depends_on = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade():
|
|
21
|
+
with op.batch_alter_table('json_storage', schema=None) as batch_op:
|
|
22
|
+
batch_op.add_column(sa.Column('encrypted_content', sa.LargeBinary(), nullable=True))
|
|
23
|
+
batch_op.alter_column('resource_id', existing_type=sa.Integer(), type_=sa.BigInteger())
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def downgrade():
|
|
27
|
+
with op.batch_alter_table('json_storage', schema=None) as batch_op:
|
|
28
|
+
batch_op.drop_column('encrypted_content')
|
|
29
|
+
batch_op.alter_column('resource_id', existing_type=sa.BigInteger(), type_=sa.Integer())
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""added_metadata_to_projects
|
|
2
|
+
|
|
3
|
+
Revision ID: 11347c213b36
|
|
4
|
+
Revises: 4521dafe89ab
|
|
5
|
+
Create Date: 2025-02-19 18:46:24.014843
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from alembic import op
|
|
9
|
+
from sqlalchemy.orm.attributes import flag_modified
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
|
|
12
|
+
import mindsdb.interfaces.storage.db as db
|
|
13
|
+
from mindsdb.utilities.config import config
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# revision identifiers, used by Alembic.
|
|
17
|
+
revision = '11347c213b36'
|
|
18
|
+
down_revision = '4521dafe89ab'
|
|
19
|
+
branch_labels = None
|
|
20
|
+
depends_on = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def upgrade():
|
|
24
|
+
with op.batch_alter_table('project', schema=None) as batch_op:
|
|
25
|
+
batch_op.add_column(sa.Column('metadata', sa.JSON(), nullable=True))
|
|
26
|
+
|
|
27
|
+
conn = op.get_bind()
|
|
28
|
+
session = sa.orm.Session(bind=conn)
|
|
29
|
+
session.commit()
|
|
30
|
+
|
|
31
|
+
project = session.query(db.Project).filter_by(name='mindsdb').first()
|
|
32
|
+
if project:
|
|
33
|
+
project.name = config.get('default_project')
|
|
34
|
+
project.metadata_ = {"is_default": True}
|
|
35
|
+
flag_modified(project, 'metadata_')
|
|
36
|
+
session.commit()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def downgrade():
|
|
40
|
+
with op.batch_alter_table('project', schema=None) as batch_op:
|
|
41
|
+
batch_op.drop_column('metadata')
|
mindsdb/utilities/config.py
CHANGED
|
@@ -149,6 +149,7 @@ class Config:
|
|
|
149
149
|
"handlers": {
|
|
150
150
|
"console": {
|
|
151
151
|
"enabled": True,
|
|
152
|
+
"formatter": "default",
|
|
152
153
|
"level": "INFO" # MINDSDB_CONSOLE_LOG_LEVEL or MINDSDB_LOG_LEVEL (obsolete)
|
|
153
154
|
},
|
|
154
155
|
"file": {
|
|
@@ -216,7 +217,8 @@ class Config:
|
|
|
216
217
|
},
|
|
217
218
|
"tasks": {
|
|
218
219
|
"disable": False
|
|
219
|
-
}
|
|
220
|
+
},
|
|
221
|
+
"default_project": "mindsdb"
|
|
220
222
|
}
|
|
221
223
|
# endregion
|
|
222
224
|
|
|
@@ -352,6 +354,9 @@ class Config:
|
|
|
352
354
|
if os.environ.get('MINDSDB_DB_CON', '') != '':
|
|
353
355
|
self._env_config['storage_db'] = os.environ['MINDSDB_DB_CON']
|
|
354
356
|
|
|
357
|
+
if os.environ.get('MINDSDB_DEFAULT_PROJECT', '') != '':
|
|
358
|
+
self._env_config['default_project'] = os.environ['MINDSDB_DEFAULT_PROJECT'].lower()
|
|
359
|
+
|
|
355
360
|
def parse_cmd_args(self) -> None:
|
|
356
361
|
"""Collect cmd args to self._cmd_args (accessable as self.cmd_args)
|
|
357
362
|
"""
|
mindsdb/utilities/functions.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import base64
|
|
3
3
|
import hashlib
|
|
4
|
+
import json
|
|
4
5
|
import datetime
|
|
5
6
|
import textwrap
|
|
6
7
|
from functools import wraps
|
|
@@ -195,3 +196,13 @@ def decrypt(encripted: bytes, key: str) -> bytes:
|
|
|
195
196
|
|
|
196
197
|
cipher = Fernet(fernet_key)
|
|
197
198
|
return cipher.decrypt(encripted)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def encrypt_json(data: dict, key: str) -> bytes:
|
|
202
|
+
json_str = json.dumps(data)
|
|
203
|
+
return encrypt(json_str.encode(), key)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def decrypt_json(encrypted_data: bytes, key: str) -> dict:
|
|
207
|
+
decrypted = decrypt(encrypted_data, key)
|
|
208
|
+
return json.loads(decrypted)
|
mindsdb/utilities/log.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import json
|
|
1
2
|
import logging
|
|
2
3
|
from logging.config import dictConfig
|
|
3
4
|
|
|
@@ -7,6 +8,19 @@ from mindsdb.utilities.config import config as app_config
|
|
|
7
8
|
logging_initialized = False
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
class JsonFormatter(logging.Formatter):
|
|
12
|
+
def format(self, record):
|
|
13
|
+
record_message = super().format(record)
|
|
14
|
+
log_record = {
|
|
15
|
+
'process_name': record.processName,
|
|
16
|
+
'name': record.name,
|
|
17
|
+
'message': record_message,
|
|
18
|
+
'level': record.levelname,
|
|
19
|
+
'time': record.created
|
|
20
|
+
}
|
|
21
|
+
return json.dumps(log_record)
|
|
22
|
+
|
|
23
|
+
|
|
10
24
|
class ColorFormatter(logging.Formatter):
|
|
11
25
|
green = "\x1b[32;20m"
|
|
12
26
|
default = "\x1b[39;20m"
|
|
@@ -53,7 +67,7 @@ def configure_logging():
|
|
|
53
67
|
if console_handler_config['enabled'] is True:
|
|
54
68
|
handlers_config['console'] = {
|
|
55
69
|
"class": "logging.StreamHandler",
|
|
56
|
-
"formatter":
|
|
70
|
+
"formatter": console_handler_config.get('formatter', 'default'),
|
|
57
71
|
"level": console_handler_config_level
|
|
58
72
|
}
|
|
59
73
|
|
|
@@ -74,7 +88,8 @@ def configure_logging():
|
|
|
74
88
|
logging_config = dict(
|
|
75
89
|
version=1,
|
|
76
90
|
formatters={
|
|
77
|
-
"
|
|
91
|
+
"default": {"()": ColorFormatter},
|
|
92
|
+
"json": {"()": JsonFormatter},
|
|
78
93
|
"file": {
|
|
79
94
|
"format": "%(asctime)s %(processName)15s %(levelname)-8s %(name)s: %(message)s"
|
|
80
95
|
}
|
|
@@ -74,7 +74,9 @@ class MLTaskConsumer(BaseRedisQueue):
|
|
|
74
74
|
|
|
75
75
|
# region collect cpu usage statistic
|
|
76
76
|
self.cpu_stat = [0] * 10
|
|
77
|
-
self._collect_cpu_stat_thread = threading.Thread(
|
|
77
|
+
self._collect_cpu_stat_thread = threading.Thread(
|
|
78
|
+
target=self._collect_cpu_stat, name='MLTaskConsumer._collect_cpu_stat'
|
|
79
|
+
)
|
|
78
80
|
self._collect_cpu_stat_thread.start()
|
|
79
81
|
# endregion
|
|
80
82
|
|
|
@@ -221,7 +223,7 @@ class MLTaskConsumer(BaseRedisQueue):
|
|
|
221
223
|
if self._ready_event.is_set() is False:
|
|
222
224
|
continue
|
|
223
225
|
self._ready_event.clear()
|
|
224
|
-
threading.Thread(target=self._listen).start()
|
|
226
|
+
threading.Thread(target=self._listen, name='MLTaskConsumer._listen').start()
|
|
225
227
|
self.stop()
|
|
226
228
|
|
|
227
229
|
def stop(self) -> None:
|
|
@@ -63,6 +63,10 @@ class AttributedStr(str):
|
|
|
63
63
|
obj.is_quoted = is_quoted
|
|
64
64
|
return obj
|
|
65
65
|
|
|
66
|
+
def replace(self, *args):
|
|
67
|
+
obj = super().replace(*args)
|
|
68
|
+
return AttributedStr(obj, self.is_quoted)
|
|
69
|
+
|
|
66
70
|
|
|
67
71
|
def get_is_quoted(identifier: ast.Identifier):
|
|
68
72
|
quoted = getattr(identifier, 'is_quoted', [])
|