MindsDB 25.5.3.0__py3-none-any.whl → 25.5.4.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 +127 -79
- mindsdb/api/a2a/__init__.py +0 -0
- mindsdb/api/a2a/__main__.py +114 -0
- mindsdb/api/a2a/a2a_client.py +439 -0
- mindsdb/api/a2a/agent.py +308 -0
- mindsdb/api/a2a/common/__init__.py +0 -0
- mindsdb/api/a2a/common/client/__init__.py +4 -0
- mindsdb/api/a2a/common/client/card_resolver.py +21 -0
- mindsdb/api/a2a/common/client/client.py +86 -0
- mindsdb/api/a2a/common/server/__init__.py +4 -0
- mindsdb/api/a2a/common/server/server.py +164 -0
- mindsdb/api/a2a/common/server/task_manager.py +287 -0
- mindsdb/api/a2a/common/server/utils.py +28 -0
- mindsdb/api/a2a/common/types.py +365 -0
- mindsdb/api/a2a/constants.py +9 -0
- mindsdb/api/a2a/run_a2a.py +129 -0
- mindsdb/api/a2a/task_manager.py +594 -0
- mindsdb/api/executor/command_executor.py +47 -27
- mindsdb/api/executor/datahub/classes/response.py +5 -2
- mindsdb/api/executor/datahub/datanodes/integration_datanode.py +39 -72
- mindsdb/api/executor/planner/query_planner.py +10 -1
- mindsdb/api/executor/sql_query/result_set.py +185 -52
- mindsdb/api/executor/sql_query/sql_query.py +1 -1
- mindsdb/api/executor/sql_query/steps/apply_predictor_step.py +9 -12
- mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +8 -10
- mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +5 -44
- mindsdb/api/executor/sql_query/steps/insert_step.py +24 -15
- mindsdb/api/executor/sql_query/steps/join_step.py +1 -1
- mindsdb/api/executor/sql_query/steps/project_step.py +1 -1
- mindsdb/api/executor/sql_query/steps/sql_steps.py +1 -1
- mindsdb/api/executor/sql_query/steps/subselect_step.py +4 -8
- mindsdb/api/executor/sql_query/steps/union_step.py +1 -3
- mindsdb/api/http/initialize.py +99 -83
- mindsdb/api/http/namespaces/analysis.py +3 -3
- mindsdb/api/http/namespaces/file.py +8 -2
- mindsdb/api/http/namespaces/sql.py +13 -27
- mindsdb/api/mcp/start.py +42 -5
- mindsdb/api/mysql/mysql_proxy/data_types/mysql_packet.py +0 -1
- mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/binary_resultset_row_package.py +52 -19
- mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +8 -10
- mindsdb/api/mysql/mysql_proxy/libs/constants/mysql.py +54 -38
- mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +82 -115
- mindsdb/api/mysql/mysql_proxy/utilities/dump.py +351 -0
- mindsdb/api/postgres/postgres_proxy/executor/executor.py +1 -1
- mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +5 -6
- mindsdb/integrations/handlers/altibase_handler/altibase_handler.py +26 -27
- mindsdb/integrations/handlers/altibase_handler/connection_args.py +13 -13
- mindsdb/integrations/handlers/altibase_handler/tests/test_altibase_handler.py +8 -8
- mindsdb/integrations/handlers/altibase_handler/tests/test_altibase_handler_dsn.py +13 -13
- mindsdb/integrations/handlers/anthropic_handler/__init__.py +2 -2
- mindsdb/integrations/handlers/anthropic_handler/anthropic_handler.py +1 -3
- mindsdb/integrations/handlers/aurora_handler/aurora_handler.py +1 -0
- mindsdb/integrations/handlers/autosklearn_handler/autosklearn_handler.py +1 -1
- mindsdb/integrations/handlers/autosklearn_handler/config.py +0 -1
- mindsdb/integrations/handlers/bigquery_handler/bigquery_handler.py +1 -1
- mindsdb/integrations/handlers/bigquery_handler/tests/test_bigquery_handler.py +1 -1
- mindsdb/integrations/handlers/binance_handler/binance_handler.py +1 -0
- mindsdb/integrations/handlers/binance_handler/binance_tables.py +3 -4
- mindsdb/integrations/handlers/byom_handler/__init__.py +0 -1
- mindsdb/integrations/handlers/ckan_handler/ckan_handler.py +3 -0
- mindsdb/integrations/handlers/clickhouse_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/cloud_spanner_handler/tests/test_cloud_spanner_handler.py +0 -2
- mindsdb/integrations/handlers/cloud_sql_handler/cloud_sql_handler.py +0 -1
- mindsdb/integrations/handlers/cohere_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/cohere_handler/cohere_handler.py +11 -13
- mindsdb/integrations/handlers/confluence_handler/confluence_tables.py +6 -0
- mindsdb/integrations/handlers/databend_handler/connection_args.py +1 -1
- mindsdb/integrations/handlers/databend_handler/databend_handler.py +4 -4
- mindsdb/integrations/handlers/databend_handler/tests/__init__.py +0 -1
- mindsdb/integrations/handlers/databend_handler/tests/test_databend_handler.py +1 -1
- mindsdb/integrations/handlers/derby_handler/connection_args.py +1 -1
- mindsdb/integrations/handlers/derby_handler/derby_handler.py +14 -22
- mindsdb/integrations/handlers/derby_handler/tests/test_derby_handler.py +6 -6
- mindsdb/integrations/handlers/discord_handler/discord_handler.py +5 -5
- mindsdb/integrations/handlers/discord_handler/discord_tables.py +3 -3
- mindsdb/integrations/handlers/discord_handler/tests/test_discord.py +5 -3
- mindsdb/integrations/handlers/dockerhub_handler/dockerhub.py +3 -3
- mindsdb/integrations/handlers/dockerhub_handler/dockerhub_handler.py +2 -2
- mindsdb/integrations/handlers/dockerhub_handler/dockerhub_tables.py +57 -54
- mindsdb/integrations/handlers/dremio_handler/__init__.py +2 -2
- mindsdb/integrations/handlers/druid_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/druid_handler/druid_handler.py +2 -2
- mindsdb/integrations/handlers/edgelessdb_handler/tests/test_edgelessdb_handler.py +9 -9
- mindsdb/integrations/handlers/email_handler/email_client.py +1 -1
- mindsdb/integrations/handlers/email_handler/email_ingestor.py +1 -1
- mindsdb/integrations/handlers/email_handler/email_tables.py +0 -1
- mindsdb/integrations/handlers/email_handler/settings.py +0 -1
- mindsdb/integrations/handlers/eventstoredb_handler/eventstoredb_handler.py +2 -1
- mindsdb/integrations/handlers/firebird_handler/firebird_handler.py +1 -1
- mindsdb/integrations/handlers/flaml_handler/flaml_handler.py +9 -9
- mindsdb/integrations/handlers/frappe_handler/frappe_client.py +5 -5
- mindsdb/integrations/handlers/frappe_handler/frappe_handler.py +6 -5
- mindsdb/integrations/handlers/frappe_handler/frappe_tables.py +2 -2
- mindsdb/integrations/handlers/github_handler/connection_args.py +2 -2
- mindsdb/integrations/handlers/github_handler/github_handler.py +1 -8
- mindsdb/integrations/handlers/github_handler/github_tables.py +13 -24
- mindsdb/integrations/handlers/gitlab_handler/gitlab_handler.py +2 -1
- mindsdb/integrations/handlers/gitlab_handler/gitlab_tables.py +1 -4
- mindsdb/integrations/handlers/gmail_handler/gmail_handler.py +6 -13
- mindsdb/integrations/handlers/google_books_handler/google_books_handler.py +2 -1
- mindsdb/integrations/handlers/google_books_handler/google_books_tables.py +0 -3
- mindsdb/integrations/handlers/google_calendar_handler/google_calendar_handler.py +4 -4
- mindsdb/integrations/handlers/google_calendar_handler/google_calendar_tables.py +2 -6
- mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_handler.py +3 -2
- mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_tables.py +0 -3
- mindsdb/integrations/handlers/google_fit_handler/google_fit_handler.py +10 -12
- mindsdb/integrations/handlers/google_fit_handler/google_fit_tables.py +11 -13
- mindsdb/integrations/handlers/google_search_handler/google_search_handler.py +2 -1
- mindsdb/integrations/handlers/google_search_handler/google_search_tables.py +0 -3
- mindsdb/integrations/handlers/groq_handler/__init__.py +3 -3
- mindsdb/integrations/handlers/hackernews_handler/hn_handler.py +5 -7
- mindsdb/integrations/handlers/hackernews_handler/hn_table.py +6 -7
- mindsdb/integrations/handlers/hive_handler/tests/test_hive_handler.py +1 -1
- mindsdb/integrations/handlers/hsqldb_handler/connection_args.py +6 -6
- mindsdb/integrations/handlers/hsqldb_handler/hsqldb_handler.py +4 -3
- mindsdb/integrations/handlers/huggingface_api_handler/exceptions.py +1 -1
- mindsdb/integrations/handlers/huggingface_api_handler/huggingface_api_handler.py +1 -8
- mindsdb/integrations/handlers/huggingface_handler/huggingface_handler.py +6 -6
- mindsdb/integrations/handlers/huggingface_handler/requirements.txt +1 -1
- mindsdb/integrations/handlers/huggingface_handler/requirements_cpu.txt +1 -1
- mindsdb/integrations/handlers/ignite_handler/ignite_handler.py +2 -1
- mindsdb/integrations/handlers/impala_handler/impala_handler.py +9 -12
- mindsdb/integrations/handlers/impala_handler/tests/test_impala_handler.py +11 -11
- mindsdb/integrations/handlers/influxdb_handler/influxdb_handler.py +10 -13
- mindsdb/integrations/handlers/influxdb_handler/influxdb_tables.py +20 -20
- mindsdb/integrations/handlers/informix_handler/__about__.py +8 -8
- mindsdb/integrations/handlers/informix_handler/__init__.py +12 -5
- mindsdb/integrations/handlers/informix_handler/informix_handler.py +99 -133
- mindsdb/integrations/handlers/informix_handler/tests/test_informix_handler.py +13 -11
- mindsdb/integrations/handlers/ingres_handler/__about__.py +0 -1
- mindsdb/integrations/handlers/ingres_handler/ingres_handler.py +1 -0
- mindsdb/integrations/handlers/jira_handler/jira_handler.py +4 -4
- mindsdb/integrations/handlers/jira_handler/jira_tables.py +9 -9
- mindsdb/integrations/handlers/kinetica_handler/__init__.py +0 -1
- mindsdb/integrations/handlers/langchain_handler/langchain_handler.py +4 -4
- mindsdb/integrations/handlers/langchain_handler/tools.py +9 -10
- mindsdb/integrations/handlers/leonardoai_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/lightwood_handler/functions.py +2 -2
- mindsdb/integrations/handlers/lightwood_handler/lightwood_handler.py +0 -1
- mindsdb/integrations/handlers/lightwood_handler/tests/test_lightwood_handler.py +11 -11
- mindsdb/integrations/handlers/llama_index_handler/llama_index_handler.py +4 -4
- mindsdb/integrations/handlers/llama_index_handler/settings.py +10 -9
- mindsdb/integrations/handlers/materialize_handler/tests/test_materialize_handler.py +8 -10
- mindsdb/integrations/handlers/matrixone_handler/matrixone_handler.py +4 -4
- mindsdb/integrations/handlers/matrixone_handler/tests/test_matrixone_handler.py +8 -9
- mindsdb/integrations/handlers/maxdb_handler/connection_args.py +25 -25
- mindsdb/integrations/handlers/maxdb_handler/maxdb_handler.py +1 -0
- mindsdb/integrations/handlers/mediawiki_handler/mediawiki_handler.py +3 -2
- mindsdb/integrations/handlers/mediawiki_handler/mediawiki_tables.py +1 -1
- mindsdb/integrations/handlers/mendeley_handler/__about__.py +1 -1
- mindsdb/integrations/handlers/mendeley_handler/__init__.py +2 -2
- mindsdb/integrations/handlers/mendeley_handler/mendeley_handler.py +48 -56
- mindsdb/integrations/handlers/mendeley_handler/mendeley_tables.py +24 -29
- mindsdb/integrations/handlers/mendeley_handler/tests/test_mendeley_handler.py +19 -17
- mindsdb/integrations/handlers/merlion_handler/merlion_handler.py +5 -4
- mindsdb/integrations/handlers/minds_endpoint_handler/__init__.py +3 -3
- mindsdb/integrations/handlers/mlflow_handler/mlflow_handler.py +58 -36
- mindsdb/integrations/handlers/monetdb_handler/__about__.py +8 -8
- mindsdb/integrations/handlers/monetdb_handler/__init__.py +15 -5
- mindsdb/integrations/handlers/monetdb_handler/connection_args.py +17 -18
- mindsdb/integrations/handlers/monetdb_handler/monetdb_handler.py +40 -57
- mindsdb/integrations/handlers/monetdb_handler/tests/test_monetdb_handler.py +7 -8
- mindsdb/integrations/handlers/monetdb_handler/utils/monet_get_id.py +13 -14
- mindsdb/integrations/handlers/monkeylearn_handler/__about__.py +1 -1
- mindsdb/integrations/handlers/monkeylearn_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/monkeylearn_handler/monkeylearn_handler.py +2 -5
- mindsdb/integrations/handlers/ms_one_drive_handler/ms_graph_api_one_drive_client.py +1 -0
- mindsdb/integrations/handlers/ms_one_drive_handler/ms_one_drive_handler.py +1 -1
- mindsdb/integrations/handlers/ms_teams_handler/ms_graph_api_teams_client.py +23 -23
- mindsdb/integrations/handlers/ms_teams_handler/ms_teams_handler.py +3 -3
- mindsdb/integrations/handlers/ms_teams_handler/ms_teams_tables.py +10 -5
- mindsdb/integrations/handlers/mssql_handler/mssql_handler.py +73 -8
- mindsdb/integrations/handlers/mysql_handler/__about__.py +8 -8
- mindsdb/integrations/handlers/mysql_handler/__init__.py +15 -5
- mindsdb/integrations/handlers/mysql_handler/connection_args.py +43 -47
- mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +101 -34
- mindsdb/integrations/handlers/mysql_handler/settings.py +15 -13
- mindsdb/integrations/handlers/neuralforecast_handler/neuralforecast_handler.py +1 -1
- mindsdb/integrations/handlers/newsapi_handler/newsapi_handler.py +1 -1
- mindsdb/integrations/handlers/newsapi_handler/tests/test_newsapi_handler.py +4 -4
- mindsdb/integrations/handlers/nuo_jdbc_handler/connection_args.py +2 -2
- mindsdb/integrations/handlers/nuo_jdbc_handler/nuo_jdbc_handler.py +28 -36
- mindsdb/integrations/handlers/nuo_jdbc_handler/tests/test_nuo_handler.py +5 -5
- mindsdb/integrations/handlers/oceanbase_handler/oceanbase_handler.py +0 -1
- mindsdb/integrations/handlers/oceanbase_handler/tests/test_oceanbase_handler.py +8 -10
- mindsdb/integrations/handlers/ollama_handler/ollama_handler.py +3 -3
- mindsdb/integrations/handlers/opengauss_handler/tests/test_opengauss_handler.py +1 -2
- mindsdb/integrations/handlers/openstreetmap_handler/__init__.py +7 -7
- mindsdb/integrations/handlers/oracle_handler/connection_args.py +6 -0
- mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +77 -11
- mindsdb/integrations/handlers/orioledb_handler/tests/test_orioledb_handler.py +8 -10
- mindsdb/integrations/handlers/palm_handler/__about__.py +1 -1
- mindsdb/integrations/handlers/palm_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/palm_handler/palm_handler.py +1 -3
- mindsdb/integrations/handlers/paypal_handler/paypal_handler.py +2 -2
- mindsdb/integrations/handlers/paypal_handler/paypal_tables.py +15 -14
- mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py +53 -10
- mindsdb/integrations/handlers/phoenix_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/phoenix_handler/phoenix_handler.py +1 -0
- mindsdb/integrations/handlers/pinot_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/pinot_handler/pinot_handler.py +3 -2
- mindsdb/integrations/handlers/plaid_handler/plaid_handler.py +13 -13
- mindsdb/integrations/handlers/plaid_handler/plaid_tables.py +10 -12
- mindsdb/integrations/handlers/plaid_handler/utils.py +4 -6
- mindsdb/integrations/handlers/planetscale_handler/planetscale_handler.py +1 -4
- mindsdb/integrations/handlers/portkey_handler/__init__.py +2 -2
- mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +105 -24
- mindsdb/integrations/handlers/postgres_handler/tests/test_postgres_handler.py +11 -6
- mindsdb/integrations/handlers/questdb_handler/questdb_handler.py +1 -2
- mindsdb/integrations/handlers/questdb_handler/tests/test_questdb_handler.py +2 -3
- mindsdb/integrations/handlers/quickbooks_handler/quickbooks_handler.py +6 -8
- mindsdb/integrations/handlers/quickbooks_handler/quickbooks_table.py +10 -10
- mindsdb/integrations/handlers/rag_handler/ingest.py +2 -2
- mindsdb/integrations/handlers/rag_handler/rag_handler.py +1 -1
- mindsdb/integrations/handlers/rag_handler/settings.py +1 -1
- mindsdb/integrations/handlers/reddit_handler/reddit_handler.py +2 -7
- mindsdb/integrations/handlers/reddit_handler/reddit_tables.py +2 -3
- mindsdb/integrations/handlers/replicate_handler/replicate_handler.py +6 -6
- mindsdb/integrations/handlers/rocket_chat_handler/rocket_chat_handler.py +1 -2
- mindsdb/integrations/handlers/rocket_chat_handler/rocket_chat_tables.py +0 -3
- mindsdb/integrations/handlers/rockset_handler/connection_args.py +14 -14
- mindsdb/integrations/handlers/rockset_handler/tests/test_rockset_handler.py +1 -0
- mindsdb/integrations/handlers/scylla_handler/scylla_handler.py +6 -5
- mindsdb/integrations/handlers/sendinblue_handler/sendinblue_handler.py +2 -1
- mindsdb/integrations/handlers/sendinblue_handler/sendinblue_tables.py +16 -16
- mindsdb/integrations/handlers/sentence_transformers_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/sheets_handler/connection_args.py +1 -1
- mindsdb/integrations/handlers/shopify_handler/shopify_handler.py +7 -6
- mindsdb/integrations/handlers/shopify_handler/shopify_tables.py +38 -41
- mindsdb/integrations/handlers/singlestore_handler/__about__.py +1 -1
- mindsdb/integrations/handlers/singlestore_handler/__init__.py +0 -1
- mindsdb/integrations/handlers/singlestore_handler/singlestore_handler.py +1 -0
- mindsdb/integrations/handlers/singlestore_handler/tests/test_singlestore_handler.py +3 -3
- mindsdb/integrations/handlers/slack_handler/__init__.py +3 -3
- mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +100 -6
- mindsdb/integrations/handlers/solr_handler/connection_args.py +7 -7
- mindsdb/integrations/handlers/solr_handler/solr_handler.py +2 -1
- mindsdb/integrations/handlers/solr_handler/tests/test_solr_handler.py +2 -1
- mindsdb/integrations/handlers/sqlany_handler/sqlany_handler.py +3 -2
- mindsdb/integrations/handlers/sqlite_handler/sqlite_handler.py +1 -0
- mindsdb/integrations/handlers/sqreamdb_handler/connection_args.py +1 -1
- mindsdb/integrations/handlers/sqreamdb_handler/sqreamdb_handler.py +15 -20
- mindsdb/integrations/handlers/sqreamdb_handler/tests/test_sqreamdb_handler.py +4 -4
- mindsdb/integrations/handlers/stabilityai_handler/__init__.py +1 -1
- mindsdb/integrations/handlers/starrocks_handler/starrocks_handler.py +0 -1
- mindsdb/integrations/handlers/starrocks_handler/tests/test_starrocks_handler.py +8 -10
- mindsdb/integrations/handlers/statsforecast_handler/statsforecast_handler.py +2 -2
- mindsdb/integrations/handlers/strava_handler/strava_handler.py +4 -8
- mindsdb/integrations/handlers/strava_handler/strava_tables.py +22 -30
- mindsdb/integrations/handlers/stripe_handler/stripe_handler.py +3 -2
- mindsdb/integrations/handlers/stripe_handler/stripe_tables.py +11 -27
- mindsdb/integrations/handlers/supabase_handler/tests/test_supabase_handler.py +1 -1
- mindsdb/integrations/handlers/surrealdb_handler/surrealdb_handler.py +4 -4
- mindsdb/integrations/handlers/tdengine_handler/tdengine_handler.py +25 -27
- mindsdb/integrations/handlers/tdengine_handler/tests/test_tdengine_handler.py +8 -8
- mindsdb/integrations/handlers/tidb_handler/tests/test_tidb_handler.py +1 -2
- mindsdb/integrations/handlers/timegpt_handler/timegpt_handler.py +5 -5
- mindsdb/integrations/handlers/tpot_handler/tpot_handler.py +21 -26
- mindsdb/integrations/handlers/trino_handler/trino_handler.py +14 -14
- mindsdb/integrations/handlers/twitter_handler/twitter_handler.py +2 -4
- mindsdb/integrations/handlers/unify_handler/tests/test_unify_handler.py +7 -8
- mindsdb/integrations/handlers/unify_handler/unify_handler.py +9 -9
- mindsdb/integrations/handlers/vertex_handler/vertex_client.py +1 -1
- mindsdb/integrations/handlers/vertica_handler/tests/test_vertica_handler.py +11 -11
- mindsdb/integrations/handlers/vertica_handler/vertica_handler.py +11 -14
- mindsdb/integrations/handlers/vitess_handler/tests/test_vitess_handler.py +9 -11
- mindsdb/integrations/handlers/vitess_handler/vitess_handler.py +0 -1
- mindsdb/integrations/handlers/web_handler/web_handler.py +1 -0
- mindsdb/integrations/handlers/whatsapp_handler/__init__.py +3 -3
- mindsdb/integrations/handlers/writer_handler/evaluate.py +1 -1
- mindsdb/integrations/handlers/writer_handler/settings.py +0 -1
- mindsdb/integrations/handlers/writer_handler/writer_handler.py +1 -0
- mindsdb/integrations/handlers/youtube_handler/youtube_handler.py +5 -5
- mindsdb/integrations/handlers/youtube_handler/youtube_tables.py +26 -27
- mindsdb/integrations/handlers/yugabyte_handler/tests/test_yugabyte_handler.py +3 -3
- mindsdb/integrations/handlers/yugabyte_handler/yugabyte_handler.py +0 -6
- mindsdb/integrations/libs/response.py +67 -52
- mindsdb/integrations/libs/vectordatabase_handler.py +6 -0
- mindsdb/integrations/utilities/handler_utils.py +15 -3
- mindsdb/integrations/utilities/handlers/api_utilities/__init__.py +0 -1
- mindsdb/integrations/utilities/handlers/auth_utilities/__init__.py +0 -2
- mindsdb/integrations/utilities/utils.py +3 -3
- mindsdb/interfaces/agents/agents_controller.py +164 -1
- mindsdb/interfaces/agents/constants.py +15 -0
- mindsdb/interfaces/agents/langchain_agent.py +16 -4
- mindsdb/interfaces/agents/mindsdb_database_agent.py +101 -2
- mindsdb/interfaces/knowledge_base/controller.py +25 -0
- mindsdb/interfaces/knowledge_base/preprocessing/document_preprocessor.py +13 -10
- mindsdb/interfaces/knowledge_base/preprocessing/json_chunker.py +434 -0
- mindsdb/interfaces/knowledge_base/preprocessing/models.py +54 -0
- mindsdb/interfaces/query_context/context_controller.py +66 -10
- mindsdb/interfaces/skills/custom/text2sql/mindsdb_kb_tools.py +190 -0
- mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +92 -0
- mindsdb/interfaces/skills/skill_tool.py +202 -57
- mindsdb/interfaces/skills/sql_agent.py +205 -17
- mindsdb/interfaces/storage/fs.py +1 -0
- mindsdb/interfaces/variables/__init__.py +0 -0
- mindsdb/interfaces/variables/variables_controller.py +97 -0
- mindsdb/migrations/env.py +5 -7
- mindsdb/migrations/migrate.py +47 -7
- mindsdb/migrations/versions/2025-05-21_9f150e4f9a05_checkpoint_1.py +360 -0
- mindsdb/utilities/config.py +331 -219
- mindsdb/utilities/starters.py +13 -0
- {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.0.dist-info}/METADATA +641 -695
- {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.0.dist-info}/RECORD +309 -288
- {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.0.dist-info}/WHEEL +1 -1
- mindsdb/integrations/handlers/monkeylearn_handler/requirements.txt +0 -1
- {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.0.dist-info}/licenses/LICENSE +0 -0
- {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.0.dist-info}/top_level.txt +0 -0
|
@@ -2,24 +2,25 @@ import unittest
|
|
|
2
2
|
from mindsdb.integrations.handlers.altibase_handler.altibase_handler import AltibaseHandler
|
|
3
3
|
from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
class AltibaseHandlerTest(unittest.TestCase):
|
|
6
7
|
@classmethod
|
|
7
8
|
def setUpClass(cls):
|
|
8
9
|
cls.kwargs = {
|
|
9
10
|
"connection_data": {
|
|
10
11
|
"dsn": "altiodbc",
|
|
11
|
-
#Override
|
|
12
|
-
#"host": "127.0.0.1",
|
|
13
|
-
#"port": 20300,
|
|
14
|
-
#"user": "sys",
|
|
15
|
-
#"password": "manager"
|
|
12
|
+
# Override
|
|
13
|
+
# "host": "127.0.0.1",
|
|
14
|
+
# "port": 20300,
|
|
15
|
+
# "user": "sys",
|
|
16
|
+
# "password": "manager"
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
cls.handler = AltibaseHandler('test_altibase_handler', **cls.kwargs)
|
|
19
20
|
|
|
20
21
|
def test_0_connect(self):
|
|
21
22
|
assert self.handler.connect()
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
def test_1_drop_table(self):
|
|
24
25
|
# Not supported 'IF EXISTS' syntax
|
|
25
26
|
res = self.handler.query("DROP TABLE TEST_TABLE")
|
|
@@ -28,20 +29,20 @@ class AltibaseHandlerTest(unittest.TestCase):
|
|
|
28
29
|
def test_2_create_table(self):
|
|
29
30
|
res = self.handler.query(
|
|
30
31
|
'''CREATE TABLE TEST_TABLE (
|
|
31
|
-
ID INT PRIMARY KEY,
|
|
32
|
+
ID INT PRIMARY KEY,
|
|
32
33
|
NAME VARCHAR(14)
|
|
33
34
|
)'''
|
|
34
|
-
|
|
35
|
+
)
|
|
35
36
|
assert res.type is RESPONSE_TYPE.OK
|
|
36
37
|
|
|
37
38
|
def test_3_insert(self):
|
|
38
39
|
res = self.handler.query(
|
|
39
|
-
"""INSERT INTO TEST_TABLE
|
|
40
|
-
VALUES
|
|
40
|
+
"""INSERT INTO TEST_TABLE
|
|
41
|
+
VALUES
|
|
41
42
|
(100,'ONE HUNDRED'),
|
|
42
43
|
(200,'TWO HUNDRED'),
|
|
43
44
|
(300,'THREE HUNDRED')"""
|
|
44
|
-
|
|
45
|
+
)
|
|
45
46
|
assert res.type is RESPONSE_TYPE.OK
|
|
46
47
|
|
|
47
48
|
def test_4_select(self):
|
|
@@ -61,8 +62,7 @@ class AltibaseHandlerTest(unittest.TestCase):
|
|
|
61
62
|
|
|
62
63
|
def test_8_disconnect(self):
|
|
63
64
|
assert self.handler.disconnect()
|
|
64
|
-
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
if __name__ == '__main__':
|
|
68
68
|
unittest.main()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
from .__about__ import __version__ as version
|
|
2
|
+
from .__about__ import __description__ as description
|
|
1
3
|
from mindsdb.integrations.libs.const import HANDLER_TYPE
|
|
2
4
|
from mindsdb.utilities import log
|
|
3
5
|
|
|
4
6
|
logger = log.getLogger(__name__)
|
|
5
7
|
|
|
6
|
-
from .__about__ import __description__ as description
|
|
7
|
-
from .__about__ import __version__ as version
|
|
8
8
|
|
|
9
9
|
try:
|
|
10
10
|
from .anthropic_handler import AnthropicHandler as Handler
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from typing import Dict, Optional
|
|
3
2
|
|
|
4
3
|
import pandas as pd
|
|
5
|
-
from anthropic import
|
|
4
|
+
from anthropic import Anthropic
|
|
6
5
|
|
|
7
6
|
from mindsdb.integrations.libs.base import BaseMLEngine
|
|
8
7
|
from mindsdb.utilities import log
|
|
9
|
-
from mindsdb.utilities.config import Config
|
|
10
8
|
|
|
11
9
|
from mindsdb.integrations.utilities.handler_utils import get_api_key
|
|
12
10
|
|
|
@@ -7,7 +7,7 @@ from mindsdb.utilities import log
|
|
|
7
7
|
from mindsdb_sql_parser.ast.base import ASTNode
|
|
8
8
|
from mindsdb.integrations.libs.base import DatabaseHandler
|
|
9
9
|
from mindsdb.utilities.render.sqlalchemy_render import SqlalchemyRender
|
|
10
|
-
from mindsdb.integrations.utilities.handlers.auth_utilities import GoogleServiceAccountOAuth2Manager
|
|
10
|
+
from mindsdb.integrations.utilities.handlers.auth_utilities.google import GoogleServiceAccountOAuth2Manager
|
|
11
11
|
from mindsdb.integrations.libs.response import (
|
|
12
12
|
HandlerStatusResponse as StatusResponse,
|
|
13
13
|
HandlerResponse as Response,
|
|
@@ -4,7 +4,7 @@ import pandas as pd
|
|
|
4
4
|
from google.cloud import bigquery
|
|
5
5
|
|
|
6
6
|
from mindsdb.integrations.handlers.bigquery_handler.bigquery_handler import BigQueryHandler
|
|
7
|
-
from mindsdb.integrations.utilities.handlers.auth_utilities import GoogleServiceAccountOAuth2Manager
|
|
7
|
+
from mindsdb.integrations.utilities.handlers.auth_utilities.google import GoogleServiceAccountOAuth2Manager
|
|
8
8
|
from mindsdb.integrations.libs.response import (
|
|
9
9
|
HandlerResponse as Response,
|
|
10
10
|
RESPONSE_TYPE,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from mindsdb.integrations.libs.api_handler import APITable
|
|
2
|
-
from mindsdb.integrations.libs.response import HandlerResponse as Response
|
|
3
2
|
from mindsdb.integrations.utilities.date_utils import interval_str_to_duration_ms, utc_date_str_to_timestamp_ms
|
|
4
3
|
from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
|
|
5
4
|
from mindsdb_sql_parser import ast
|
|
@@ -21,7 +20,7 @@ class BinanceAggregatedTradesTable(APITable):
|
|
|
21
20
|
|
|
22
21
|
def _get_batch_klines(self, executor: ThreadPoolExecutor, total_results: int, params: Dict) -> pd.DataFrame:
|
|
23
22
|
"""Gets aggregate trade data in batches and combines the results together.
|
|
24
|
-
|
|
23
|
+
|
|
25
24
|
Returns all results as a pandas DataFrame.
|
|
26
25
|
|
|
27
26
|
Args:
|
|
@@ -70,7 +69,7 @@ class BinanceAggregatedTradesTable(APITable):
|
|
|
70
69
|
|
|
71
70
|
def _get_kline_params_from_conditions(self, conditions: List) -> Dict:
|
|
72
71
|
"""Gets aggregate trade data API params from SQL WHERE conditions.
|
|
73
|
-
|
|
72
|
+
|
|
74
73
|
Returns params to use for Binance API call to klines.
|
|
75
74
|
|
|
76
75
|
Args:
|
|
@@ -111,7 +110,7 @@ class BinanceAggregatedTradesTable(APITable):
|
|
|
111
110
|
|
|
112
111
|
def select(self, query: ast.Select) -> pd.DataFrame:
|
|
113
112
|
"""Selects data from the Binance API and returns it as a pandas DataFrame.
|
|
114
|
-
|
|
113
|
+
|
|
115
114
|
Returns dataframe representing the Binance API results.
|
|
116
115
|
|
|
117
116
|
Args:
|
|
@@ -19,6 +19,7 @@ class DatasetsTable(APITable):
|
|
|
19
19
|
Datasets table contains information about CKAN datasets.
|
|
20
20
|
This table is used to list all datasets available in CKAN that have datastore active resources.
|
|
21
21
|
'''
|
|
22
|
+
|
|
22
23
|
def select(self, query: ast.Select) -> pd.DataFrame:
|
|
23
24
|
conditions = extract_comparison_conditions(query.where) if query.where else []
|
|
24
25
|
limit = query.limit.value if query.limit else 1000
|
|
@@ -63,6 +64,7 @@ class ResourceIDsTable(APITable):
|
|
|
63
64
|
ResourceIDs table contains information about CKAN resources.
|
|
64
65
|
This table is used to list all resources available in CKAN that are datastore active.
|
|
65
66
|
'''
|
|
67
|
+
|
|
66
68
|
def select(self, query: ast.Select) -> pd.DataFrame:
|
|
67
69
|
conditions = extract_comparison_conditions(query.where) if query.where else []
|
|
68
70
|
limit = query.limit.value if query.limit else 1000
|
|
@@ -114,6 +116,7 @@ class DatastoreTable(APITable):
|
|
|
114
116
|
This table is used to query data from CKAN datastore resources.
|
|
115
117
|
It is using the datastore_search_sql API to execute SQL queries on CKAN datastore resources.
|
|
116
118
|
'''
|
|
119
|
+
|
|
117
120
|
def select(self, query: ast.Select) -> pd.DataFrame:
|
|
118
121
|
conditions = extract_comparison_conditions(query.where) if query.where else []
|
|
119
122
|
resource_id = self.extract_resource_id(conditions)
|
|
@@ -13,7 +13,6 @@ class CloudSpannerHandlerTest(unittest.TestCase):
|
|
|
13
13
|
cls.kwargs = {'connection_data': {'database_id': 'example-db', 'instance_id': 'test-instance', 'project': 'your-project-id'}}
|
|
14
14
|
cls.handler = CloudSpannerHandler('test_cloud_spanner_handler', **cls.kwargs)
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
def test_0_connect(self):
|
|
18
17
|
self.handler.connect()
|
|
19
18
|
|
|
@@ -24,7 +23,6 @@ class CloudSpannerHandlerTest(unittest.TestCase):
|
|
|
24
23
|
res = self.handler.query('CREATE TABLE integers(i INT64) PRIMARY KEY (i)')
|
|
25
24
|
assert res.type is not RESPONSE_TYPE.ERROR
|
|
26
25
|
|
|
27
|
-
|
|
28
26
|
def test_3_insert_into_table(self):
|
|
29
27
|
res = self.handler.query('INSERT INTO integers (i) VALUES (42)')
|
|
30
28
|
assert res.type is not RESPONSE_TYPE.ERROR
|
|
@@ -2,7 +2,6 @@ from typing import Optional
|
|
|
2
2
|
|
|
3
3
|
from mindsdb_sql_parser.ast.base import ASTNode
|
|
4
4
|
|
|
5
|
-
from mindsdb.utilities import log
|
|
6
5
|
from mindsdb.integrations.libs.base import DatabaseHandler
|
|
7
6
|
from mindsdb.integrations.libs.response import (
|
|
8
7
|
HandlerStatusResponse as StatusResponse
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
from .__about__ import __version__ as version, __description__ as description
|
|
1
2
|
from mindsdb.integrations.libs.const import HANDLER_TYPE
|
|
2
3
|
from mindsdb.utilities import log
|
|
3
4
|
|
|
4
5
|
logger = log.getLogger(__name__)
|
|
5
6
|
|
|
6
|
-
from .__about__ import __version__ as version, __description__ as description
|
|
7
7
|
try:
|
|
8
8
|
from .cohere_handler import CohereHandler as Handler
|
|
9
9
|
import_error = None
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from typing import Optional, Dict
|
|
3
2
|
|
|
4
3
|
import cohere
|
|
5
4
|
import pandas as pd
|
|
6
5
|
|
|
7
|
-
from mindsdb.utilities.config import Config
|
|
8
6
|
from mindsdb.integrations.libs.base import BaseMLEngine
|
|
9
7
|
|
|
10
8
|
from mindsdb.utilities import log
|
|
@@ -14,6 +12,7 @@ from mindsdb.integrations.utilities.handler_utils import get_api_key
|
|
|
14
12
|
|
|
15
13
|
logger = log.getLogger(__name__)
|
|
16
14
|
|
|
15
|
+
|
|
17
16
|
class CohereHandler(BaseMLEngine):
|
|
18
17
|
"""
|
|
19
18
|
Integration with the Cohere Python Library
|
|
@@ -39,28 +38,27 @@ class CohereHandler(BaseMLEngine):
|
|
|
39
38
|
|
|
40
39
|
if input_column not in df.columns:
|
|
41
40
|
raise RuntimeError(f'Column "{input_column}" not found in input data')
|
|
42
|
-
|
|
43
|
-
result_df = pd.DataFrame()
|
|
41
|
+
|
|
42
|
+
result_df = pd.DataFrame()
|
|
44
43
|
|
|
45
44
|
if args['using']['task'] == 'text-summarization':
|
|
46
|
-
result_df['predictions'] = df[input_column].apply(self.predict_text_summary)
|
|
45
|
+
result_df['predictions'] = df[input_column].apply(self.predict_text_summary)
|
|
47
46
|
|
|
48
47
|
elif args['using']['task'] == 'text-generation':
|
|
49
48
|
result_df['predictions'] = df[input_column].apply(self.predict_text_generation)
|
|
50
|
-
|
|
49
|
+
|
|
51
50
|
else:
|
|
52
51
|
raise Exception(f"Task {args['using']['task']} is not supported!")
|
|
53
52
|
|
|
54
53
|
result_df = result_df.rename(columns={'predictions': args['target']})
|
|
55
|
-
|
|
56
|
-
return result_df
|
|
57
54
|
|
|
55
|
+
return result_df
|
|
58
56
|
|
|
59
|
-
def predict_text_summary(self,text):
|
|
60
|
-
"""
|
|
57
|
+
def predict_text_summary(self, text):
|
|
58
|
+
"""
|
|
61
59
|
connects with cohere api to predict the summary of the input text
|
|
62
60
|
|
|
63
|
-
"""
|
|
61
|
+
"""
|
|
64
62
|
|
|
65
63
|
args = self.model_storage.json_get('args')
|
|
66
64
|
|
|
@@ -72,8 +70,8 @@ class CohereHandler(BaseMLEngine):
|
|
|
72
70
|
|
|
73
71
|
return text_summary
|
|
74
72
|
|
|
75
|
-
def predict_text_generation(self,text):
|
|
76
|
-
"""
|
|
73
|
+
def predict_text_generation(self, text):
|
|
74
|
+
"""
|
|
77
75
|
connects with cohere api to predict the next prompt of the input text
|
|
78
76
|
|
|
79
77
|
"""
|
|
@@ -19,6 +19,7 @@ class ConfluenceSpacesTable(APIResource):
|
|
|
19
19
|
"""
|
|
20
20
|
The table abstraction for the 'spaces' resource of the Confluence API.
|
|
21
21
|
"""
|
|
22
|
+
|
|
22
23
|
def list(
|
|
23
24
|
self,
|
|
24
25
|
conditions: List[FilterCondition] = None,
|
|
@@ -145,6 +146,7 @@ class ConfluencePagesTable(APIResource):
|
|
|
145
146
|
"""
|
|
146
147
|
The table abstraction for the 'pages' resource of the Confluence API.
|
|
147
148
|
"""
|
|
149
|
+
|
|
148
150
|
def list(
|
|
149
151
|
self,
|
|
150
152
|
conditions: List[FilterCondition] = None,
|
|
@@ -281,6 +283,7 @@ class ConfluenceBlogPostsTable(APIResource):
|
|
|
281
283
|
"""
|
|
282
284
|
The table abstraction for the 'blogposts' resource of the Confluence API.
|
|
283
285
|
"""
|
|
286
|
+
|
|
284
287
|
def list(
|
|
285
288
|
self,
|
|
286
289
|
conditions: List[FilterCondition] = None,
|
|
@@ -412,6 +415,7 @@ class ConfluenceWhiteboardsTable(APIResource):
|
|
|
412
415
|
"""
|
|
413
416
|
The table abstraction for the 'whiteboards' resource of the Confluence API.
|
|
414
417
|
"""
|
|
418
|
+
|
|
415
419
|
def list(
|
|
416
420
|
self,
|
|
417
421
|
conditions: List[FilterCondition] = None,
|
|
@@ -488,6 +492,7 @@ class ConfluenceDatabasesTable(APIResource):
|
|
|
488
492
|
"""
|
|
489
493
|
The table abstraction for the 'databases' resource of the Confluence API.
|
|
490
494
|
"""
|
|
495
|
+
|
|
491
496
|
def list(
|
|
492
497
|
self,
|
|
493
498
|
conditions: List[FilterCondition] = None,
|
|
@@ -564,6 +569,7 @@ class ConfluenceTasksTable(APIResource):
|
|
|
564
569
|
"""
|
|
565
570
|
The table abstraction for the 'tasks' resource of the Confluence API.
|
|
566
571
|
"""
|
|
572
|
+
|
|
567
573
|
def list(
|
|
568
574
|
self,
|
|
569
575
|
conditions: List[FilterCondition] = None,
|
|
@@ -69,7 +69,7 @@ class DatabendHandler(DatabaseHandler):
|
|
|
69
69
|
self.is_connected = True
|
|
70
70
|
|
|
71
71
|
return self.connection
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
def disconnect(self):
|
|
74
74
|
"""
|
|
75
75
|
Close any existing connections.
|
|
@@ -105,7 +105,7 @@ class DatabendHandler(DatabaseHandler):
|
|
|
105
105
|
self.is_connected = False
|
|
106
106
|
|
|
107
107
|
return response
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
def native_query(self, query: str) -> StatusResponse:
|
|
110
110
|
"""
|
|
111
111
|
Receive raw query and act upon it somehow.
|
|
@@ -146,7 +146,7 @@ class DatabendHandler(DatabaseHandler):
|
|
|
146
146
|
self.disconnect()
|
|
147
147
|
|
|
148
148
|
return response
|
|
149
|
-
|
|
149
|
+
|
|
150
150
|
def query(self, query: ASTNode) -> StatusResponse:
|
|
151
151
|
"""
|
|
152
152
|
Receive query as AST (abstract syntax tree) and act upon it somehow.
|
|
@@ -178,7 +178,7 @@ class DatabendHandler(DatabaseHandler):
|
|
|
178
178
|
result.data_frame = df.rename(columns={f'Tables_in_{self.connection_data["database"]}': 'table_name'})
|
|
179
179
|
|
|
180
180
|
return result
|
|
181
|
-
|
|
181
|
+
|
|
182
182
|
def get_columns(self, table_name: str) -> StatusResponse:
|
|
183
183
|
"""
|
|
184
184
|
Returns a list of entity columns.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -47,4 +47,4 @@ connection_args_example = OrderedDict(
|
|
|
47
47
|
database="testdb",
|
|
48
48
|
jdbcClass='org.apache.derby.jdbc.ClientDriver',
|
|
49
49
|
jdbcJarLocation='/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derby.jar,/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derbyclient.jar,/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derbynet.jar,/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derbyoptionaltools.jar,/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derbyrun.jar,/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derbyshared.jar,/opt/homebrew/Cellar/derby/10.16.1.1/libexec/lib/derbytools.jar',
|
|
50
|
-
)
|
|
50
|
+
)
|
|
@@ -13,11 +13,10 @@ import jaydebeapi as jdbcconnector
|
|
|
13
13
|
|
|
14
14
|
logger = log.getLogger(__name__)
|
|
15
15
|
|
|
16
|
-
class DerbyHandler(DatabaseHandler):
|
|
17
|
-
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
class DerbyHandler(DatabaseHandler):
|
|
20
18
|
|
|
19
|
+
name = 'derby'
|
|
21
20
|
|
|
22
21
|
def __init__(self, name: str, connection_data: Optional[dict], **kwargs):
|
|
23
22
|
""" Initialize the handler
|
|
@@ -27,18 +26,17 @@ class DerbyHandler(DatabaseHandler):
|
|
|
27
26
|
**kwargs: arbitrary keyword arguments.
|
|
28
27
|
"""
|
|
29
28
|
super().__init__(name)
|
|
30
|
-
|
|
29
|
+
|
|
31
30
|
self.kwargs = kwargs
|
|
32
31
|
self.parser = parse_sql
|
|
33
32
|
self.database = connection_data['database']
|
|
34
33
|
self.connection_config = connection_data
|
|
35
34
|
self.host = connection_data['host']
|
|
36
35
|
self.port = connection_data['port']
|
|
37
|
-
self.schema =
|
|
36
|
+
self.schema = 'APP'
|
|
38
37
|
self.connection = None
|
|
39
38
|
self.is_connected = False
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
|
|
42
40
|
def connect(self):
|
|
43
41
|
""" Set up any connections required by the handler
|
|
44
42
|
Should return output of check_connection() method after attempting
|
|
@@ -56,18 +54,18 @@ class DerbyHandler(DatabaseHandler):
|
|
|
56
54
|
|
|
57
55
|
jdbc_url = "jdbc:derby://" + self.host + ":" + self.port + "/" + self.database + ";"
|
|
58
56
|
|
|
59
|
-
if not jdbc_class:
|
|
57
|
+
if not jdbc_class:
|
|
60
58
|
jdbc_class = "org.apache.derby.jdbc.ClientDriver"
|
|
61
59
|
|
|
62
|
-
if user:
|
|
60
|
+
if user:
|
|
63
61
|
self.schema = user
|
|
64
62
|
|
|
65
63
|
try:
|
|
66
|
-
if user and password and jar_location:
|
|
64
|
+
if user and password and jar_location:
|
|
67
65
|
self.connection = jdbcconnector.connect(jclassname=jdbc_class, url=jdbc_url, driver_args=[user, password], jars=jar_location.split(","))
|
|
68
|
-
elif user and password:
|
|
66
|
+
elif user and password:
|
|
69
67
|
self.connection = jdbcconnector.connect(jclassname=jdbc_class, url=jdbc_url, driver_args=[user, password])
|
|
70
|
-
elif jar_location:
|
|
68
|
+
elif jar_location:
|
|
71
69
|
self.connection = jdbcconnector.connect(jclassname=jdbc_class, url=jdbc_url, jars=jar_location.split(","))
|
|
72
70
|
else:
|
|
73
71
|
self.connection = jdbcconnector.connect(jdbc_class, jdbc_url)
|
|
@@ -76,7 +74,6 @@ class DerbyHandler(DatabaseHandler):
|
|
|
76
74
|
|
|
77
75
|
return self.connection
|
|
78
76
|
|
|
79
|
-
|
|
80
77
|
def disconnect(self):
|
|
81
78
|
""" Close any existing connections
|
|
82
79
|
Should switch self.is_connected.
|
|
@@ -85,12 +82,11 @@ class DerbyHandler(DatabaseHandler):
|
|
|
85
82
|
return
|
|
86
83
|
try:
|
|
87
84
|
self.connection.close()
|
|
88
|
-
self.is_connected=False
|
|
85
|
+
self.is_connected = False
|
|
89
86
|
except Exception as e:
|
|
90
87
|
logger.error(f"Error while disconnecting to {self.database}, {e}")
|
|
91
88
|
|
|
92
|
-
return
|
|
93
|
-
|
|
89
|
+
return
|
|
94
90
|
|
|
95
91
|
def check_connection(self) -> StatusResponse:
|
|
96
92
|
""" Check connection to the handler
|
|
@@ -114,7 +110,6 @@ class DerbyHandler(DatabaseHandler):
|
|
|
114
110
|
|
|
115
111
|
return responseCode
|
|
116
112
|
|
|
117
|
-
|
|
118
113
|
def native_query(self, query: str) -> StatusResponse:
|
|
119
114
|
"""Receive raw query and act upon it somehow.
|
|
120
115
|
Args:
|
|
@@ -129,7 +124,7 @@ class DerbyHandler(DatabaseHandler):
|
|
|
129
124
|
try:
|
|
130
125
|
cur.execute(query)
|
|
131
126
|
if cur.description:
|
|
132
|
-
result = cur.fetchall()
|
|
127
|
+
result = cur.fetchall()
|
|
133
128
|
response = Response(
|
|
134
129
|
RESPONSE_TYPE.TABLE,
|
|
135
130
|
data_frame=pd.DataFrame(
|
|
@@ -153,7 +148,6 @@ class DerbyHandler(DatabaseHandler):
|
|
|
153
148
|
|
|
154
149
|
return response
|
|
155
150
|
|
|
156
|
-
|
|
157
151
|
def query(self, query: ASTNode) -> StatusResponse:
|
|
158
152
|
"""Render and execute a SQL query.
|
|
159
153
|
|
|
@@ -173,7 +167,6 @@ class DerbyHandler(DatabaseHandler):
|
|
|
173
167
|
|
|
174
168
|
return self.native_query(query_str)
|
|
175
169
|
|
|
176
|
-
|
|
177
170
|
def get_tables(self) -> StatusResponse:
|
|
178
171
|
"""Get a list of all the tables in the database.
|
|
179
172
|
|
|
@@ -182,13 +175,12 @@ class DerbyHandler(DatabaseHandler):
|
|
|
182
175
|
"""
|
|
183
176
|
query = f'''
|
|
184
177
|
SELECT st.tablename FROM sys.systables st LEFT OUTER JOIN sys.sysschemas ss ON (st.schemaid = ss.schemaid) WHERE ss.schemaname ='{self.schema}' '''
|
|
185
|
-
|
|
178
|
+
|
|
186
179
|
result = self.native_query(query)
|
|
187
180
|
df = result.data_frame
|
|
188
181
|
result.data_frame = df.rename(columns={df.columns[0]: 'table_name'})
|
|
189
182
|
return result
|
|
190
183
|
|
|
191
|
-
|
|
192
184
|
def get_columns(self, table_name: str) -> StatusResponse:
|
|
193
185
|
"""Get details about a table.
|
|
194
186
|
|
|
@@ -2,6 +2,7 @@ import unittest
|
|
|
2
2
|
from mindsdb.integrations.handlers.derby_handler.derby_handler import DerbyHandler
|
|
3
3
|
from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
class DerbyHandlerTest(unittest.TestCase):
|
|
6
7
|
@classmethod
|
|
7
8
|
def setUpClass(cls):
|
|
@@ -9,14 +10,14 @@ class DerbyHandlerTest(unittest.TestCase):
|
|
|
9
10
|
"connection_data": {
|
|
10
11
|
"host": "localhost",
|
|
11
12
|
"port": "1527",
|
|
12
|
-
"database": "seconddb",
|
|
13
|
+
"database": "seconddb",
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
cls.handler = DerbyHandler('test_derby_handler', **cls.kwargs)
|
|
16
17
|
|
|
17
18
|
def test_0_connect(self):
|
|
18
19
|
self.handler.connect()
|
|
19
|
-
|
|
20
|
+
|
|
20
21
|
def test_1_check_connection(self):
|
|
21
22
|
self.handler.check_connection()
|
|
22
23
|
|
|
@@ -31,7 +32,7 @@ class DerbyHandlerTest(unittest.TestCase):
|
|
|
31
32
|
def test_4_select(self):
|
|
32
33
|
res = self.handler.query('SELECT * FROM TESTTABLEX')
|
|
33
34
|
assert res.type is RESPONSE_TYPE.TABLE
|
|
34
|
-
|
|
35
|
+
|
|
35
36
|
def test_5_get_tables(self):
|
|
36
37
|
res = self.handler.get_tables()
|
|
37
38
|
assert res.type is RESPONSE_TYPE.TABLE
|
|
@@ -39,8 +40,7 @@ class DerbyHandlerTest(unittest.TestCase):
|
|
|
39
40
|
def test_6_get_columns(self):
|
|
40
41
|
res = self.handler.get_columns("TESTTABLEX")
|
|
41
42
|
assert res.type is RESPONSE_TYPE.TABLE
|
|
42
|
-
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
if __name__ == '__main__':
|
|
46
|
-
unittest.main()
|
|
46
|
+
unittest.main()
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import requests
|
|
2
|
-
import asyncio
|
|
3
2
|
import pandas as pd
|
|
4
3
|
|
|
5
4
|
from mindsdb.integrations.handlers.discord_handler.discord_tables import MessagesTable
|
|
@@ -18,6 +17,7 @@ from mindsdb.integrations.libs.response import (
|
|
|
18
17
|
discord_bot = None
|
|
19
18
|
logger = log.getLogger(__name__)
|
|
20
19
|
|
|
20
|
+
|
|
21
21
|
class DiscordHandler(APIHandler):
|
|
22
22
|
"""
|
|
23
23
|
The Discord handler implementation.
|
|
@@ -55,7 +55,7 @@ class DiscordHandler(APIHandler):
|
|
|
55
55
|
if self.is_connected:
|
|
56
56
|
return StatusResponse(True)
|
|
57
57
|
|
|
58
|
-
url =
|
|
58
|
+
url = 'https://discord.com/api/v10/applications/@me'
|
|
59
59
|
result = requests.get(
|
|
60
60
|
url,
|
|
61
61
|
headers={
|
|
@@ -105,7 +105,7 @@ class DiscordHandler(APIHandler):
|
|
|
105
105
|
df = self.call_discord_api(operation, params)
|
|
106
106
|
|
|
107
107
|
return Response(RESPONSE_TYPE.TABLE, data_frame=df)
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
def utc_to_snowflake(self, utc_date: str) -> int:
|
|
110
110
|
"""
|
|
111
111
|
Convert a UTC date to a Snowflake date.
|
|
@@ -120,8 +120,8 @@ class DiscordHandler(APIHandler):
|
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
def call_discord_api(
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
self, operation: str, params: dict = None, filters: list = None
|
|
124
|
+
):
|
|
125
125
|
"""
|
|
126
126
|
Call a Discord API method.
|
|
127
127
|
Args:
|