MindsDB 25.4.5.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.

Files changed (350) hide show
  1. mindsdb/__about__.py +1 -1
  2. mindsdb/__main__.py +215 -185
  3. mindsdb/api/a2a/__init__.py +0 -0
  4. mindsdb/api/a2a/__main__.py +114 -0
  5. mindsdb/api/a2a/a2a_client.py +439 -0
  6. mindsdb/api/a2a/agent.py +308 -0
  7. mindsdb/api/a2a/common/__init__.py +0 -0
  8. mindsdb/api/a2a/common/client/__init__.py +4 -0
  9. mindsdb/api/a2a/common/client/card_resolver.py +21 -0
  10. mindsdb/api/a2a/common/client/client.py +86 -0
  11. mindsdb/api/a2a/common/server/__init__.py +4 -0
  12. mindsdb/api/a2a/common/server/server.py +164 -0
  13. mindsdb/api/a2a/common/server/task_manager.py +287 -0
  14. mindsdb/api/a2a/common/server/utils.py +28 -0
  15. mindsdb/api/a2a/common/types.py +365 -0
  16. mindsdb/api/a2a/constants.py +9 -0
  17. mindsdb/api/a2a/run_a2a.py +129 -0
  18. mindsdb/api/a2a/task_manager.py +594 -0
  19. mindsdb/api/executor/command_executor.py +49 -28
  20. mindsdb/api/executor/datahub/classes/response.py +5 -2
  21. mindsdb/api/executor/datahub/datanodes/information_schema_datanode.py +8 -0
  22. mindsdb/api/executor/datahub/datanodes/integration_datanode.py +39 -72
  23. mindsdb/api/executor/datahub/datanodes/system_tables.py +10 -13
  24. mindsdb/api/executor/planner/query_planner.py +14 -2
  25. mindsdb/api/executor/sql_query/result_set.py +185 -52
  26. mindsdb/api/executor/sql_query/sql_query.py +1 -1
  27. mindsdb/api/executor/sql_query/steps/apply_predictor_step.py +11 -13
  28. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +8 -10
  29. mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +5 -44
  30. mindsdb/api/executor/sql_query/steps/insert_step.py +24 -15
  31. mindsdb/api/executor/sql_query/steps/join_step.py +1 -1
  32. mindsdb/api/executor/sql_query/steps/project_step.py +1 -1
  33. mindsdb/api/executor/sql_query/steps/sql_steps.py +1 -1
  34. mindsdb/api/executor/sql_query/steps/subselect_step.py +4 -8
  35. mindsdb/api/executor/sql_query/steps/union_step.py +1 -3
  36. mindsdb/api/http/initialize.py +118 -85
  37. mindsdb/api/http/namespaces/analysis.py +17 -4
  38. mindsdb/api/http/namespaces/file.py +8 -2
  39. mindsdb/api/http/namespaces/sql.py +13 -27
  40. mindsdb/api/http/namespaces/tree.py +1 -1
  41. mindsdb/api/http/start.py +7 -2
  42. mindsdb/api/mcp/start.py +42 -5
  43. mindsdb/api/mysql/mysql_proxy/data_types/mysql_packet.py +0 -1
  44. mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/binary_resultset_row_package.py +52 -19
  45. mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +8 -10
  46. mindsdb/api/mysql/mysql_proxy/libs/constants/mysql.py +54 -38
  47. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +86 -123
  48. mindsdb/api/mysql/mysql_proxy/utilities/dump.py +351 -0
  49. mindsdb/api/mysql/mysql_proxy/utilities/exceptions.py +0 -4
  50. mindsdb/api/postgres/postgres_proxy/executor/executor.py +1 -1
  51. mindsdb/api/postgres/postgres_proxy/postgres_packets/postgres_message_formats.py +2 -2
  52. mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +5 -6
  53. mindsdb/integrations/handlers/altibase_handler/altibase_handler.py +26 -27
  54. mindsdb/integrations/handlers/altibase_handler/connection_args.py +13 -13
  55. mindsdb/integrations/handlers/altibase_handler/tests/test_altibase_handler.py +8 -8
  56. mindsdb/integrations/handlers/altibase_handler/tests/test_altibase_handler_dsn.py +13 -13
  57. mindsdb/integrations/handlers/anthropic_handler/__init__.py +2 -2
  58. mindsdb/integrations/handlers/anthropic_handler/anthropic_handler.py +1 -3
  59. mindsdb/integrations/handlers/aurora_handler/aurora_handler.py +1 -0
  60. mindsdb/integrations/handlers/autosklearn_handler/autosklearn_handler.py +1 -1
  61. mindsdb/integrations/handlers/autosklearn_handler/config.py +0 -1
  62. mindsdb/integrations/handlers/bigquery_handler/bigquery_handler.py +1 -1
  63. mindsdb/integrations/handlers/bigquery_handler/requirements.txt +1 -0
  64. mindsdb/integrations/handlers/bigquery_handler/tests/test_bigquery_handler.py +1 -1
  65. mindsdb/integrations/handlers/binance_handler/binance_handler.py +1 -0
  66. mindsdb/integrations/handlers/binance_handler/binance_tables.py +3 -4
  67. mindsdb/integrations/handlers/byom_handler/__init__.py +0 -1
  68. mindsdb/integrations/handlers/chromadb_handler/requirements.txt +1 -0
  69. mindsdb/integrations/handlers/ckan_handler/ckan_handler.py +3 -0
  70. mindsdb/integrations/handlers/clickhouse_handler/__init__.py +1 -1
  71. mindsdb/integrations/handlers/cloud_spanner_handler/tests/test_cloud_spanner_handler.py +0 -2
  72. mindsdb/integrations/handlers/cloud_sql_handler/cloud_sql_handler.py +0 -1
  73. mindsdb/integrations/handlers/cohere_handler/__init__.py +1 -1
  74. mindsdb/integrations/handlers/cohere_handler/cohere_handler.py +11 -13
  75. mindsdb/integrations/handlers/confluence_handler/confluence_tables.py +6 -0
  76. mindsdb/integrations/handlers/databend_handler/connection_args.py +1 -1
  77. mindsdb/integrations/handlers/databend_handler/databend_handler.py +4 -4
  78. mindsdb/integrations/handlers/databend_handler/tests/__init__.py +0 -1
  79. mindsdb/integrations/handlers/databend_handler/tests/test_databend_handler.py +1 -1
  80. mindsdb/integrations/handlers/derby_handler/connection_args.py +1 -1
  81. mindsdb/integrations/handlers/derby_handler/derby_handler.py +14 -22
  82. mindsdb/integrations/handlers/derby_handler/tests/test_derby_handler.py +6 -6
  83. mindsdb/integrations/handlers/discord_handler/discord_handler.py +5 -5
  84. mindsdb/integrations/handlers/discord_handler/discord_tables.py +3 -3
  85. mindsdb/integrations/handlers/discord_handler/tests/test_discord.py +5 -3
  86. mindsdb/integrations/handlers/dockerhub_handler/dockerhub.py +3 -3
  87. mindsdb/integrations/handlers/dockerhub_handler/dockerhub_handler.py +2 -2
  88. mindsdb/integrations/handlers/dockerhub_handler/dockerhub_tables.py +57 -54
  89. mindsdb/integrations/handlers/dremio_handler/__init__.py +2 -2
  90. mindsdb/integrations/handlers/druid_handler/__init__.py +1 -1
  91. mindsdb/integrations/handlers/druid_handler/druid_handler.py +2 -2
  92. mindsdb/integrations/handlers/edgelessdb_handler/tests/test_edgelessdb_handler.py +9 -9
  93. mindsdb/integrations/handlers/email_handler/email_client.py +1 -1
  94. mindsdb/integrations/handlers/email_handler/email_ingestor.py +1 -1
  95. mindsdb/integrations/handlers/email_handler/email_tables.py +0 -1
  96. mindsdb/integrations/handlers/email_handler/settings.py +0 -1
  97. mindsdb/integrations/handlers/eventstoredb_handler/eventstoredb_handler.py +2 -1
  98. mindsdb/integrations/handlers/firebird_handler/firebird_handler.py +1 -1
  99. mindsdb/integrations/handlers/flaml_handler/flaml_handler.py +9 -9
  100. mindsdb/integrations/handlers/frappe_handler/frappe_client.py +5 -5
  101. mindsdb/integrations/handlers/frappe_handler/frappe_handler.py +6 -5
  102. mindsdb/integrations/handlers/frappe_handler/frappe_tables.py +2 -2
  103. mindsdb/integrations/handlers/github_handler/connection_args.py +2 -2
  104. mindsdb/integrations/handlers/github_handler/github_handler.py +1 -8
  105. mindsdb/integrations/handlers/github_handler/github_tables.py +13 -24
  106. mindsdb/integrations/handlers/gitlab_handler/gitlab_handler.py +2 -1
  107. mindsdb/integrations/handlers/gitlab_handler/gitlab_tables.py +1 -4
  108. mindsdb/integrations/handlers/gmail_handler/gmail_handler.py +6 -13
  109. mindsdb/integrations/handlers/gmail_handler/requirements.txt +1 -0
  110. mindsdb/integrations/handlers/google_analytics_handler/requirements.txt +2 -1
  111. mindsdb/integrations/handlers/google_books_handler/google_books_handler.py +2 -1
  112. mindsdb/integrations/handlers/google_books_handler/google_books_tables.py +0 -3
  113. mindsdb/integrations/handlers/google_books_handler/requirements.txt +1 -1
  114. mindsdb/integrations/handlers/google_calendar_handler/google_calendar_handler.py +4 -4
  115. mindsdb/integrations/handlers/google_calendar_handler/google_calendar_tables.py +2 -6
  116. mindsdb/integrations/handlers/google_calendar_handler/requirements.txt +1 -0
  117. mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_handler.py +3 -2
  118. mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_tables.py +0 -3
  119. mindsdb/integrations/handlers/google_content_shopping_handler/requirements.txt +1 -1
  120. mindsdb/integrations/handlers/google_fit_handler/google_fit_handler.py +10 -12
  121. mindsdb/integrations/handlers/google_fit_handler/google_fit_tables.py +11 -13
  122. mindsdb/integrations/handlers/google_fit_handler/requirements.txt +2 -0
  123. mindsdb/integrations/handlers/google_search_handler/google_search_handler.py +2 -1
  124. mindsdb/integrations/handlers/google_search_handler/google_search_tables.py +0 -3
  125. mindsdb/integrations/handlers/google_search_handler/requirements.txt +1 -1
  126. mindsdb/integrations/handlers/groq_handler/__init__.py +3 -3
  127. mindsdb/integrations/handlers/hackernews_handler/hn_handler.py +5 -7
  128. mindsdb/integrations/handlers/hackernews_handler/hn_table.py +6 -7
  129. mindsdb/integrations/handlers/hive_handler/tests/test_hive_handler.py +1 -1
  130. mindsdb/integrations/handlers/hsqldb_handler/connection_args.py +6 -6
  131. mindsdb/integrations/handlers/hsqldb_handler/hsqldb_handler.py +4 -3
  132. mindsdb/integrations/handlers/huggingface_api_handler/exceptions.py +1 -1
  133. mindsdb/integrations/handlers/huggingface_api_handler/huggingface_api_handler.py +1 -8
  134. mindsdb/integrations/handlers/huggingface_handler/huggingface_handler.py +6 -6
  135. mindsdb/integrations/handlers/huggingface_handler/requirements.txt +1 -1
  136. mindsdb/integrations/handlers/huggingface_handler/requirements_cpu.txt +1 -1
  137. mindsdb/integrations/handlers/ignite_handler/ignite_handler.py +2 -1
  138. mindsdb/integrations/handlers/impala_handler/impala_handler.py +9 -12
  139. mindsdb/integrations/handlers/impala_handler/tests/test_impala_handler.py +11 -11
  140. mindsdb/integrations/handlers/influxdb_handler/influxdb_handler.py +10 -13
  141. mindsdb/integrations/handlers/influxdb_handler/influxdb_tables.py +20 -20
  142. mindsdb/integrations/handlers/informix_handler/__about__.py +8 -8
  143. mindsdb/integrations/handlers/informix_handler/__init__.py +12 -5
  144. mindsdb/integrations/handlers/informix_handler/informix_handler.py +99 -133
  145. mindsdb/integrations/handlers/informix_handler/tests/test_informix_handler.py +13 -11
  146. mindsdb/integrations/handlers/ingres_handler/__about__.py +0 -1
  147. mindsdb/integrations/handlers/ingres_handler/ingres_handler.py +1 -0
  148. mindsdb/integrations/handlers/jira_handler/jira_handler.archived.py +75 -0
  149. mindsdb/integrations/handlers/jira_handler/jira_handler.py +113 -38
  150. mindsdb/integrations/handlers/jira_handler/jira_tables.py +229 -0
  151. mindsdb/integrations/handlers/jira_handler/requirements.txt +1 -0
  152. mindsdb/integrations/handlers/kinetica_handler/__init__.py +0 -1
  153. mindsdb/integrations/handlers/langchain_handler/langchain_handler.py +4 -4
  154. mindsdb/integrations/handlers/langchain_handler/tools.py +9 -10
  155. mindsdb/integrations/handlers/leonardoai_handler/__init__.py +1 -1
  156. mindsdb/integrations/handlers/lightfm_handler/requirements.txt +1 -0
  157. mindsdb/integrations/handlers/lightwood_handler/functions.py +2 -2
  158. mindsdb/integrations/handlers/lightwood_handler/lightwood_handler.py +0 -3
  159. mindsdb/integrations/handlers/lightwood_handler/requirements.txt +4 -4
  160. mindsdb/integrations/handlers/lightwood_handler/tests/test_lightwood_handler.py +11 -11
  161. mindsdb/integrations/handlers/lindorm_handler/requirements.txt +1 -0
  162. mindsdb/integrations/handlers/llama_index_handler/llama_index_handler.py +4 -4
  163. mindsdb/integrations/handlers/llama_index_handler/settings.py +10 -9
  164. mindsdb/integrations/handlers/materialize_handler/tests/test_materialize_handler.py +8 -10
  165. mindsdb/integrations/handlers/matrixone_handler/matrixone_handler.py +4 -4
  166. mindsdb/integrations/handlers/matrixone_handler/tests/test_matrixone_handler.py +8 -9
  167. mindsdb/integrations/handlers/maxdb_handler/connection_args.py +25 -25
  168. mindsdb/integrations/handlers/maxdb_handler/maxdb_handler.py +1 -0
  169. mindsdb/integrations/handlers/mediawiki_handler/mediawiki_handler.py +3 -2
  170. mindsdb/integrations/handlers/mediawiki_handler/mediawiki_tables.py +1 -1
  171. mindsdb/integrations/handlers/mendeley_handler/__about__.py +1 -1
  172. mindsdb/integrations/handlers/mendeley_handler/__init__.py +2 -2
  173. mindsdb/integrations/handlers/mendeley_handler/mendeley_handler.py +48 -56
  174. mindsdb/integrations/handlers/mendeley_handler/mendeley_tables.py +24 -29
  175. mindsdb/integrations/handlers/mendeley_handler/tests/test_mendeley_handler.py +19 -17
  176. mindsdb/integrations/handlers/merlion_handler/merlion_handler.py +5 -4
  177. mindsdb/integrations/handlers/minds_endpoint_handler/__init__.py +3 -3
  178. mindsdb/integrations/handlers/mlflow_handler/mlflow_handler.py +58 -36
  179. mindsdb/integrations/handlers/monetdb_handler/__about__.py +8 -8
  180. mindsdb/integrations/handlers/monetdb_handler/__init__.py +15 -5
  181. mindsdb/integrations/handlers/monetdb_handler/connection_args.py +17 -18
  182. mindsdb/integrations/handlers/monetdb_handler/monetdb_handler.py +40 -57
  183. mindsdb/integrations/handlers/monetdb_handler/tests/test_monetdb_handler.py +7 -8
  184. mindsdb/integrations/handlers/monetdb_handler/utils/monet_get_id.py +13 -14
  185. mindsdb/integrations/handlers/monkeylearn_handler/__about__.py +1 -1
  186. mindsdb/integrations/handlers/monkeylearn_handler/__init__.py +1 -1
  187. mindsdb/integrations/handlers/monkeylearn_handler/monkeylearn_handler.py +2 -5
  188. mindsdb/integrations/handlers/ms_one_drive_handler/ms_graph_api_one_drive_client.py +1 -0
  189. mindsdb/integrations/handlers/ms_one_drive_handler/ms_one_drive_handler.py +1 -1
  190. mindsdb/integrations/handlers/ms_one_drive_handler/requirements.txt +2 -0
  191. mindsdb/integrations/handlers/ms_teams_handler/ms_graph_api_teams_client.py +23 -23
  192. mindsdb/integrations/handlers/ms_teams_handler/ms_teams_handler.py +3 -3
  193. mindsdb/integrations/handlers/ms_teams_handler/ms_teams_tables.py +10 -5
  194. mindsdb/integrations/handlers/ms_teams_handler/requirements.txt +3 -1
  195. mindsdb/integrations/handlers/mssql_handler/mssql_handler.py +73 -8
  196. mindsdb/integrations/handlers/mysql_handler/__about__.py +8 -8
  197. mindsdb/integrations/handlers/mysql_handler/__init__.py +15 -5
  198. mindsdb/integrations/handlers/mysql_handler/connection_args.py +43 -47
  199. mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +101 -34
  200. mindsdb/integrations/handlers/mysql_handler/settings.py +15 -13
  201. mindsdb/integrations/handlers/neuralforecast_handler/neuralforecast_handler.py +1 -1
  202. mindsdb/integrations/handlers/newsapi_handler/newsapi_handler.py +1 -1
  203. mindsdb/integrations/handlers/newsapi_handler/tests/test_newsapi_handler.py +4 -4
  204. mindsdb/integrations/handlers/nuo_jdbc_handler/connection_args.py +2 -2
  205. mindsdb/integrations/handlers/nuo_jdbc_handler/nuo_jdbc_handler.py +28 -36
  206. mindsdb/integrations/handlers/nuo_jdbc_handler/tests/test_nuo_handler.py +5 -5
  207. mindsdb/integrations/handlers/oceanbase_handler/oceanbase_handler.py +0 -1
  208. mindsdb/integrations/handlers/oceanbase_handler/tests/test_oceanbase_handler.py +8 -10
  209. mindsdb/integrations/handlers/ollama_handler/ollama_handler.py +3 -3
  210. mindsdb/integrations/handlers/openai_handler/openai_handler.py +5 -4
  211. mindsdb/integrations/handlers/opengauss_handler/tests/test_opengauss_handler.py +1 -2
  212. mindsdb/integrations/handlers/openstreetmap_handler/__init__.py +7 -7
  213. mindsdb/integrations/handlers/oracle_handler/connection_args.py +6 -0
  214. mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +77 -11
  215. mindsdb/integrations/handlers/orioledb_handler/tests/test_orioledb_handler.py +8 -10
  216. mindsdb/integrations/handlers/palm_handler/__about__.py +1 -1
  217. mindsdb/integrations/handlers/palm_handler/__init__.py +1 -1
  218. mindsdb/integrations/handlers/palm_handler/palm_handler.py +1 -3
  219. mindsdb/integrations/handlers/paypal_handler/paypal_handler.py +2 -2
  220. mindsdb/integrations/handlers/paypal_handler/paypal_tables.py +15 -14
  221. mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py +53 -10
  222. mindsdb/integrations/handlers/phoenix_handler/__init__.py +1 -1
  223. mindsdb/integrations/handlers/phoenix_handler/phoenix_handler.py +1 -0
  224. mindsdb/integrations/handlers/pinot_handler/__init__.py +1 -1
  225. mindsdb/integrations/handlers/pinot_handler/pinot_handler.py +3 -2
  226. mindsdb/integrations/handlers/plaid_handler/plaid_handler.py +13 -13
  227. mindsdb/integrations/handlers/plaid_handler/plaid_tables.py +10 -12
  228. mindsdb/integrations/handlers/plaid_handler/utils.py +4 -6
  229. mindsdb/integrations/handlers/planetscale_handler/planetscale_handler.py +1 -4
  230. mindsdb/integrations/handlers/portkey_handler/__init__.py +2 -2
  231. mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +105 -24
  232. mindsdb/integrations/handlers/postgres_handler/tests/test_postgres_handler.py +11 -6
  233. mindsdb/integrations/handlers/questdb_handler/questdb_handler.py +1 -2
  234. mindsdb/integrations/handlers/questdb_handler/tests/test_questdb_handler.py +2 -3
  235. mindsdb/integrations/handlers/quickbooks_handler/quickbooks_handler.py +6 -8
  236. mindsdb/integrations/handlers/quickbooks_handler/quickbooks_table.py +10 -10
  237. mindsdb/integrations/handlers/rag_handler/ingest.py +2 -2
  238. mindsdb/integrations/handlers/rag_handler/rag_handler.py +1 -1
  239. mindsdb/integrations/handlers/rag_handler/settings.py +1 -1
  240. mindsdb/integrations/handlers/reddit_handler/reddit_handler.py +2 -7
  241. mindsdb/integrations/handlers/reddit_handler/reddit_tables.py +2 -3
  242. mindsdb/integrations/handlers/replicate_handler/replicate_handler.py +6 -6
  243. mindsdb/integrations/handlers/rocket_chat_handler/rocket_chat_handler.py +1 -2
  244. mindsdb/integrations/handlers/rocket_chat_handler/rocket_chat_tables.py +0 -3
  245. mindsdb/integrations/handlers/rockset_handler/connection_args.py +14 -14
  246. mindsdb/integrations/handlers/rockset_handler/tests/test_rockset_handler.py +1 -0
  247. mindsdb/integrations/handlers/scylla_handler/scylla_handler.py +6 -5
  248. mindsdb/integrations/handlers/sendinblue_handler/sendinblue_handler.py +2 -1
  249. mindsdb/integrations/handlers/sendinblue_handler/sendinblue_tables.py +16 -16
  250. mindsdb/integrations/handlers/sentence_transformers_handler/__init__.py +1 -1
  251. mindsdb/integrations/handlers/sheets_handler/connection_args.py +1 -1
  252. mindsdb/integrations/handlers/shopify_handler/shopify_handler.py +7 -6
  253. mindsdb/integrations/handlers/shopify_handler/shopify_tables.py +38 -41
  254. mindsdb/integrations/handlers/singlestore_handler/__about__.py +1 -1
  255. mindsdb/integrations/handlers/singlestore_handler/__init__.py +0 -1
  256. mindsdb/integrations/handlers/singlestore_handler/singlestore_handler.py +1 -0
  257. mindsdb/integrations/handlers/singlestore_handler/tests/test_singlestore_handler.py +3 -3
  258. mindsdb/integrations/handlers/slack_handler/__init__.py +3 -3
  259. mindsdb/integrations/handlers/snowflake_handler/requirements.txt +1 -1
  260. mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +100 -6
  261. mindsdb/integrations/handlers/solr_handler/connection_args.py +7 -7
  262. mindsdb/integrations/handlers/solr_handler/solr_handler.py +2 -1
  263. mindsdb/integrations/handlers/solr_handler/tests/test_solr_handler.py +2 -1
  264. mindsdb/integrations/handlers/sqlany_handler/sqlany_handler.py +3 -2
  265. mindsdb/integrations/handlers/sqlite_handler/sqlite_handler.py +1 -0
  266. mindsdb/integrations/handlers/sqreamdb_handler/connection_args.py +1 -1
  267. mindsdb/integrations/handlers/sqreamdb_handler/sqreamdb_handler.py +15 -20
  268. mindsdb/integrations/handlers/sqreamdb_handler/tests/test_sqreamdb_handler.py +4 -4
  269. mindsdb/integrations/handlers/stabilityai_handler/__init__.py +1 -1
  270. mindsdb/integrations/handlers/starrocks_handler/starrocks_handler.py +0 -1
  271. mindsdb/integrations/handlers/starrocks_handler/tests/test_starrocks_handler.py +8 -10
  272. mindsdb/integrations/handlers/statsforecast_handler/statsforecast_handler.py +2 -2
  273. mindsdb/integrations/handlers/strava_handler/strava_handler.py +4 -8
  274. mindsdb/integrations/handlers/strava_handler/strava_tables.py +22 -30
  275. mindsdb/integrations/handlers/stripe_handler/stripe_handler.py +3 -2
  276. mindsdb/integrations/handlers/stripe_handler/stripe_tables.py +11 -27
  277. mindsdb/integrations/handlers/supabase_handler/tests/test_supabase_handler.py +1 -1
  278. mindsdb/integrations/handlers/surrealdb_handler/surrealdb_handler.py +4 -4
  279. mindsdb/integrations/handlers/tdengine_handler/tdengine_handler.py +25 -27
  280. mindsdb/integrations/handlers/tdengine_handler/tests/test_tdengine_handler.py +8 -8
  281. mindsdb/integrations/handlers/tidb_handler/tests/test_tidb_handler.py +1 -2
  282. mindsdb/integrations/handlers/timegpt_handler/timegpt_handler.py +5 -5
  283. mindsdb/integrations/handlers/tpot_handler/tpot_handler.py +21 -26
  284. mindsdb/integrations/handlers/trino_handler/trino_handler.py +14 -14
  285. mindsdb/integrations/handlers/twitter_handler/twitter_handler.py +2 -4
  286. mindsdb/integrations/handlers/unify_handler/tests/test_unify_handler.py +7 -8
  287. mindsdb/integrations/handlers/unify_handler/unify_handler.py +9 -9
  288. mindsdb/integrations/handlers/vertex_handler/requirements.txt +1 -0
  289. mindsdb/integrations/handlers/vertex_handler/vertex_client.py +1 -1
  290. mindsdb/integrations/handlers/vertica_handler/tests/test_vertica_handler.py +11 -11
  291. mindsdb/integrations/handlers/vertica_handler/vertica_handler.py +11 -14
  292. mindsdb/integrations/handlers/vitess_handler/tests/test_vitess_handler.py +9 -11
  293. mindsdb/integrations/handlers/vitess_handler/vitess_handler.py +0 -1
  294. mindsdb/integrations/handlers/web_handler/web_handler.py +1 -0
  295. mindsdb/integrations/handlers/whatsapp_handler/__init__.py +3 -3
  296. mindsdb/integrations/handlers/writer_handler/evaluate.py +1 -1
  297. mindsdb/integrations/handlers/writer_handler/settings.py +0 -1
  298. mindsdb/integrations/handlers/writer_handler/writer_handler.py +1 -0
  299. mindsdb/integrations/handlers/youtube_handler/requirements.txt +1 -0
  300. mindsdb/integrations/handlers/youtube_handler/youtube_handler.py +5 -5
  301. mindsdb/integrations/handlers/youtube_handler/youtube_tables.py +26 -27
  302. mindsdb/integrations/handlers/yugabyte_handler/tests/test_yugabyte_handler.py +3 -3
  303. mindsdb/integrations/handlers/yugabyte_handler/yugabyte_handler.py +0 -6
  304. mindsdb/integrations/libs/response.py +67 -52
  305. mindsdb/integrations/libs/vectordatabase_handler.py +6 -0
  306. mindsdb/integrations/utilities/files/file_reader.py +5 -2
  307. mindsdb/integrations/utilities/handler_utils.py +15 -3
  308. mindsdb/integrations/utilities/handlers/api_utilities/__init__.py +0 -1
  309. mindsdb/integrations/utilities/handlers/auth_utilities/__init__.py +0 -2
  310. mindsdb/integrations/utilities/utils.py +3 -3
  311. mindsdb/interfaces/agents/agents_controller.py +164 -1
  312. mindsdb/interfaces/agents/constants.py +29 -2
  313. mindsdb/interfaces/agents/langchain_agent.py +18 -8
  314. mindsdb/interfaces/agents/mindsdb_database_agent.py +101 -2
  315. mindsdb/interfaces/database/projects.py +1 -7
  316. mindsdb/interfaces/functions/controller.py +11 -14
  317. mindsdb/interfaces/functions/to_markdown.py +9 -124
  318. mindsdb/interfaces/knowledge_base/controller.py +47 -19
  319. mindsdb/interfaces/knowledge_base/preprocessing/document_preprocessor.py +41 -15
  320. mindsdb/interfaces/knowledge_base/preprocessing/json_chunker.py +434 -0
  321. mindsdb/interfaces/knowledge_base/preprocessing/models.py +54 -0
  322. mindsdb/interfaces/knowledge_base/utils.py +10 -15
  323. mindsdb/interfaces/model/model_controller.py +0 -2
  324. mindsdb/interfaces/query_context/context_controller.py +66 -10
  325. mindsdb/interfaces/skills/custom/text2sql/mindsdb_kb_tools.py +190 -0
  326. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +92 -0
  327. mindsdb/interfaces/skills/skill_tool.py +202 -57
  328. mindsdb/interfaces/skills/sql_agent.py +238 -28
  329. mindsdb/interfaces/storage/fs.py +1 -0
  330. mindsdb/interfaces/variables/__init__.py +0 -0
  331. mindsdb/interfaces/variables/variables_controller.py +97 -0
  332. mindsdb/migrations/env.py +5 -7
  333. mindsdb/migrations/migrate.py +47 -9
  334. mindsdb/migrations/versions/2025-05-21_9f150e4f9a05_checkpoint_1.py +360 -0
  335. mindsdb/utilities/config.py +333 -220
  336. mindsdb/utilities/context.py +1 -1
  337. mindsdb/utilities/functions.py +0 -36
  338. mindsdb/utilities/langfuse.py +19 -10
  339. mindsdb/utilities/otel/__init__.py +9 -193
  340. mindsdb/utilities/otel/metric_handlers/__init__.py +5 -1
  341. mindsdb/utilities/otel/prepare.py +198 -0
  342. mindsdb/utilities/sql.py +83 -0
  343. mindsdb/utilities/starters.py +13 -0
  344. {mindsdb-25.4.5.0.dist-info → mindsdb-25.5.4.0.dist-info}/METADATA +351 -338
  345. {mindsdb-25.4.5.0.dist-info → mindsdb-25.5.4.0.dist-info}/RECORD +348 -322
  346. {mindsdb-25.4.5.0.dist-info → mindsdb-25.5.4.0.dist-info}/WHEEL +1 -1
  347. mindsdb/api/mysql/mysql_proxy/classes/sql_statement_parser.py +0 -151
  348. mindsdb/integrations/handlers/monkeylearn_handler/requirements.txt +0 -1
  349. {mindsdb-25.4.5.0.dist-info → mindsdb-25.5.4.0.dist-info}/licenses/LICENSE +0 -0
  350. {mindsdb-25.4.5.0.dist-info → mindsdb-25.5.4.0.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,6 @@
1
1
  import pytest
2
2
  import psycopg2
3
3
  import os
4
- import time
5
4
 
6
5
  from mindsdb.integrations.handlers.postgres_handler.postgres_handler import (
7
6
  PostgresHandler,
@@ -14,7 +13,9 @@ HANDLER_KWARGS = {
14
13
  "port": os.environ.get("MDB_TEST_POSTGRES_PORT", "5432"),
15
14
  "user": os.environ.get("MDB_TEST_POSTGRES_USER", "postgres"),
16
15
  "password": os.environ.get("MDB_TEST_POSTGRES_PASSWORD", "supersecret"),
17
- "database": os.environ.get("MDB_TEST_POSTGRES_DATABASE", "postgres_db_handler_test"),
16
+ "database": os.environ.get(
17
+ "MDB_TEST_POSTGRES_DATABASE", "postgres_db_handler_test"
18
+ ),
18
19
  }
19
20
  }
20
21
 
@@ -24,6 +25,7 @@ expected_columns = ["col_one", "col_two", "col_three", "col_four"]
24
25
 
25
26
  curr_dir = os.path.dirname(os.path.realpath(__file__))
26
27
 
28
+
27
29
  def seed_db():
28
30
  """Seed the test DB with some data"""
29
31
 
@@ -36,7 +38,7 @@ def seed_db():
36
38
  try:
37
39
  cursor.execute("DROP DATABASE IF EXISTS postgres_db_handler_test;")
38
40
  db.commit()
39
-
41
+
40
42
  # Create the test database
41
43
  cursor.execute("CREATE DATABASE postgres_db_handler_test;")
42
44
 
@@ -56,12 +58,14 @@ def seed_db():
56
58
  cursor.close()
57
59
  db.close()
58
60
 
61
+
59
62
  @pytest.fixture(scope="module")
60
63
  def handler(request):
61
64
  seed_db()
62
65
  handler = PostgresHandler(**HANDLER_KWARGS)
63
66
  yield handler
64
67
 
68
+
65
69
  def check_valid_response(res):
66
70
  if res.resp_type == RESPONSE_TYPE.TABLE:
67
71
  assert res.data_frame is not None, "expected to have some data, but got None"
@@ -72,6 +76,7 @@ def check_valid_response(res):
72
76
  res.error_message is None
73
77
  ), f"expected to have None in error message, but got {res.error_message}"
74
78
 
79
+
75
80
  def get_table_names(handler):
76
81
  res = handler.get_tables()
77
82
  tables = res.data_frame
@@ -157,15 +162,15 @@ class TestPostgresColumns:
157
162
  describe_data = described.data_frame
158
163
  check_valid_response(described)
159
164
  got_columns = list(describe_data.iloc[:, 0])
160
- assert (
161
- set(got_columns) == set(expected_columns)
165
+ assert set(got_columns) == set(
166
+ expected_columns
162
167
  ), f"expected to have next columns in test table:\n{expected_columns}\nbut got:\n{got_columns}"
163
168
 
164
169
 
165
170
  class TestPostgresDisconnect:
166
171
  def test_disconnect(self, handler):
167
172
  handler.disconnect()
168
- assert handler.is_connected == False, "failed to disconnect"
173
+ assert handler.is_connected is False, "failed to disconnect"
169
174
 
170
175
  def test_check_connection(self, handler):
171
176
  res = handler.check_connection()
@@ -5,7 +5,6 @@ from questdb.ingress import Sender
5
5
 
6
6
  from mindsdb.integrations.handlers.postgres_handler import Handler as PostgresHandler
7
7
  from mindsdb.integrations.libs.response import (
8
- HandlerStatusResponse as StatusResponse,
9
8
  HandlerResponse as Response,
10
9
  RESPONSE_TYPE
11
10
  )
@@ -17,7 +16,7 @@ logger = log.getLogger(__name__)
17
16
 
18
17
  class QuestDBHandler(PostgresHandler):
19
18
  """
20
- This handler handles connection and execution of the QuestDB statements.
19
+ This handler handles connection and execution of the QuestDB statements.
21
20
  TODO: check the dialect for questdb
22
21
  """
23
22
  name = 'questdb'
@@ -19,11 +19,11 @@ class QuestDBHandlerTest(unittest.TestCase):
19
19
 
20
20
  def test_0_check_connection(self):
21
21
  assert self.handler.check_connection()
22
-
22
+
23
23
  def test_1_describe_table(self):
24
24
  described = self.handler.describe_table("house_rentals_data")
25
25
  assert described['type'] is not RESPONSE_TYPE.ERROR
26
-
26
+
27
27
  def test_2_get_tables(self):
28
28
  tables = self.handler.get_tables()
29
29
  assert tables['type'] is not RESPONSE_TYPE.ERROR
@@ -32,4 +32,3 @@ class QuestDBHandlerTest(unittest.TestCase):
32
32
  query = "SELECT * FROM house_rentals_data WHERE 'id'='1'"
33
33
  result = self.handler.query(query)
34
34
  assert len(result) > 0
35
-
@@ -1,11 +1,8 @@
1
1
  import os
2
- import pandas as pd
3
2
  from qbosdk import QuickbooksOnlineSDK
4
3
  from mindsdb.integrations.libs.api_handler import APIHandler
5
4
  from mindsdb.integrations.libs.response import (
6
- HandlerStatusResponse as StatusResponse,
7
- HandlerResponse as Response,
8
- RESPONSE_TYPE
5
+ HandlerStatusResponse as StatusResponse
9
6
  )
10
7
  from mindsdb.utilities.config import Config
11
8
  from mindsdb.utilities import log
@@ -14,11 +11,12 @@ from .quickbooks_table import AccountsTable, PurchasesTable, BillPaymentsTable,
14
11
 
15
12
  logger = log.getLogger(__name__)
16
13
 
14
+
17
15
  class QuickbooksHandler(APIHandler):
18
16
  """
19
17
  A class for handling connections and interactions with Quickbooks API.
20
18
  """
21
-
19
+
22
20
  def __init__(self, name=None, **kwargs):
23
21
  super().__init__(name)
24
22
 
@@ -26,7 +24,7 @@ class QuickbooksHandler(APIHandler):
26
24
 
27
25
  self.connection_args = {}
28
26
  handler_config = Config().get('quickbooks_handler', {})
29
- for k in ['client_id', 'client_secret', 'refresh_token', 'realm_id', 'environment']:
27
+ for k in ['client_id', 'client_secret', 'refresh_token', 'realm_id', 'environment']:
30
28
  if k in args:
31
29
  self.connection_args[k] = args[k]
32
30
  elif f'QUICKBOOKS_{k.upper()}' in os.environ:
@@ -39,7 +37,7 @@ class QuickbooksHandler(APIHandler):
39
37
 
40
38
  accountso = AccountsTable(self)
41
39
  self._register_table('accountso', accountso)
42
- purchases= PurchasesTable(self)
40
+ purchases = PurchasesTable(self)
43
41
  self._register_table('purchases', purchases)
44
42
  bills_payments = BillPaymentsTable(self)
45
43
  self._register_table('bills_payments', bills_payments)
@@ -47,7 +45,7 @@ class QuickbooksHandler(APIHandler):
47
45
  self._register_table('vendors', vendors)
48
46
  bills = BillsTable(self)
49
47
  self._register_table('bills', bills)
50
- employees= EmployeesTable(self)
48
+ employees = EmployeesTable(self)
51
49
  self._register_table('employees', employees)
52
50
 
53
51
  def connect(self):
@@ -1,7 +1,6 @@
1
1
  import pandas as pd
2
2
  from mindsdb.integrations.libs.api_handler import APITable
3
3
  from mindsdb_sql_parser import ast
4
- from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
5
4
 
6
5
 
7
6
  class AccountsTable(APITable):
@@ -77,8 +76,6 @@ class PurchasesTable(APITable):
77
76
  flat_data[f"{prefix}{key}"] = value
78
77
  return flat_data
79
78
 
80
-
81
-
82
79
  def select(self, query: ast.Select) -> pd.DataFrame:
83
80
  qbo = self.handler.connect()
84
81
  purchases_data = qbo.purchases.get()
@@ -124,6 +121,7 @@ class PurchasesTable(APITable):
124
121
  if len(columns) > 0:
125
122
  result = result[columns]
126
123
 
124
+
127
125
  class BillPaymentsTable(APITable):
128
126
  def flatten_dict(self, data: dict, prefix: str = ""):
129
127
  flat_data = {}
@@ -174,7 +172,7 @@ class BillPaymentsTable(APITable):
174
172
  'domain',
175
173
  'sparse',
176
174
  ]
177
-
175
+
178
176
  def filter_columns(self, result: pd.DataFrame, query: ast.Select = None):
179
177
  columns = []
180
178
  if query is not None:
@@ -187,8 +185,9 @@ class BillPaymentsTable(APITable):
187
185
  if len(columns) > 0:
188
186
  result = result[columns]
189
187
 
188
+
190
189
  class VendorsTable(APITable):
191
-
190
+
192
191
  def flatten_dict(self, data: dict, prefix: str = ""):
193
192
  flat_data = {}
194
193
  for key, value in data.items():
@@ -198,7 +197,7 @@ class VendorsTable(APITable):
198
197
  else:
199
198
  flat_data[f"{prefix}{key}"] = value
200
199
  return flat_data
201
-
200
+
202
201
  def select(self, query: ast.Select) -> pd.DataFrame:
203
202
  qbo = self.handler.connect()
204
203
  vendors_data = qbo.vendors.get()
@@ -206,7 +205,7 @@ class VendorsTable(APITable):
206
205
  result = pd.DataFrame(flattened_vendors_data)
207
206
  self.filter_columns(result, query)
208
207
  return result
209
-
208
+
210
209
  def get_columns(self):
211
210
  return [
212
211
  'Balance',
@@ -223,7 +222,7 @@ class VendorsTable(APITable):
223
222
  'domain',
224
223
  'sparse'
225
224
  ]
226
-
225
+
227
226
  def filter_columns(self, result: pd.DataFrame, query: ast.Select = None):
228
227
  columns = []
229
228
  if query is not None:
@@ -316,8 +315,9 @@ class BillsTable(APITable):
316
315
  if len(columns) > 0:
317
316
  result = result[columns]
318
317
 
318
+
319
319
  class EmployeesTable(APITable):
320
-
320
+
321
321
  def flatten_dict(self, data: dict, prefix: str = ""):
322
322
  flat_data = {}
323
323
  for key, value in data.items():
@@ -371,4 +371,4 @@ class EmployeesTable(APITable):
371
371
  elif isinstance(target, ast.Identifier):
372
372
  columns.append(target.value)
373
373
  if len(columns) > 0:
374
- result = result[columns]
374
+ result = result[columns]
@@ -64,7 +64,7 @@ class RAGIngestor:
64
64
 
65
65
  def split_documents(self, chunk_size, chunk_overlap) -> list:
66
66
  # Load documents and split in chunks
67
- logger.info(f"Loading documents from input data")
67
+ logger.info("Loading documents from input data")
68
68
 
69
69
  documents = []
70
70
 
@@ -146,7 +146,7 @@ class RAGIngestor:
146
146
  self.embeddings_model_name, self.args.use_gpu
147
147
  )
148
148
 
149
- logger.info(f"Creating vectorstore from documents")
149
+ logger.info("Creating vectorstore from documents")
150
150
 
151
151
  if not validate_documents(documents):
152
152
  raise ValueError("Invalid documents")
@@ -61,7 +61,7 @@ class RAGHandler(BaseMLEngine):
61
61
  ml_engine_args = self.engine_storage.get_connection_args()
62
62
 
63
63
  # for a model created with USING, only get api for that specific llm type
64
- args.update({k:v for k, v in ml_engine_args.items() if args["llm_type"] in k})
64
+ args.update({k: v for k, v in ml_engine_args.items() if args["llm_type"] in k})
65
65
 
66
66
  input_args = build_llm_params(args)
67
67
 
@@ -34,7 +34,7 @@ SUPPORTED_VECTOR_STORES = ("chromadb", "faiss")
34
34
 
35
35
  SUPPORTED_LLMS = ("writer", "openai")
36
36
 
37
- ## Default parameters for RAG Handler
37
+ # Default parameters for RAG Handler
38
38
 
39
39
  # this is the default prompt template for qa
40
40
  DEFAULT_QA_PROMPT_TEMPLATE = """
@@ -1,6 +1,5 @@
1
1
  import praw
2
- import pandas as pd
3
- from datetime import datetime
2
+ import os
4
3
  from mindsdb.integrations.libs.api_handler import APIHandler
5
4
  from mindsdb.integrations.libs.response import (
6
5
  HandlerStatusResponse as StatusResponse,
@@ -14,8 +13,8 @@ from .reddit_tables import CommentTable, SubmissionTable
14
13
 
15
14
  logger = log.getLogger(__name__)
16
15
 
17
- class RedditHandler(APIHandler):
18
16
 
17
+ class RedditHandler(APIHandler):
19
18
 
20
19
  def __init__(self, name=None, **kwargs):
21
20
  super().__init__(name)
@@ -57,7 +56,6 @@ class RedditHandler(APIHandler):
57
56
  self.is_connected = True
58
57
  return self.reddit
59
58
 
60
-
61
59
  def check_connection(self) -> StatusResponse:
62
60
  '''It evaluates if the connection with Reddit API is alive and healthy.
63
61
  Returns:
@@ -101,6 +99,3 @@ class RedditHandler(APIHandler):
101
99
  RESPONSE_TYPE.TABLE,
102
100
  data_frame=df
103
101
  )
104
-
105
-
106
-
@@ -49,7 +49,6 @@ class CommentTable(APITable):
49
49
  self.filter_columns(result, query)
50
50
  return result
51
51
 
52
-
53
52
  def get_columns(self):
54
53
  '''Get the list of column names for the comment table.
55
54
 
@@ -80,6 +79,7 @@ class CommentTable(APITable):
80
79
  if len(columns) > 0:
81
80
  result = result[columns]
82
81
 
82
+
83
83
  class SubmissionTable(APITable):
84
84
  def select(self, query: ast.Select) -> pd.DataFrame:
85
85
  '''Select data from the submission table and return it as a pandas DataFrame.
@@ -143,7 +143,6 @@ class SubmissionTable(APITable):
143
143
  self.filter_columns(result, query)
144
144
  return result
145
145
 
146
-
147
146
  def get_columns(self):
148
147
  '''Get the list of column names for the submission table.
149
148
 
@@ -188,7 +187,7 @@ class SubmissionTable(APITable):
188
187
  result[col] = None
189
188
 
190
189
  result = result[columns]
191
-
190
+
192
191
  if query is not None and query.limit is not None:
193
192
  return result.head(query.limit.value)
194
193
 
@@ -33,7 +33,7 @@ class ReplicateHandler(BaseMLEngine):
33
33
  raise Exception("Provided api_key is Incorrect. Get your api_key here: https://replicate.com/account/api-tokens")
34
34
 
35
35
  else:
36
- raise Exception(f"Error occured.", e)
36
+ raise Exception("Error occured.", e)
37
37
 
38
38
  def create(self, target: str, df: Optional[pd.DataFrame] = None, args: Optional[Dict] = None) -> None:
39
39
  """Saves model details in storage to access it later
@@ -44,11 +44,11 @@ class ReplicateHandler(BaseMLEngine):
44
44
 
45
45
  def predict(self, df: pd.DataFrame, args: Optional[Dict] = None) -> pd.DataFrame:
46
46
  """Using replicate makes the prediction according to your parameters
47
-
47
+
48
48
  Args:
49
49
  df (pd.DataFrame): The input DataFrame containing data to predict.
50
50
  args (Optional[Dict]): Additional arguments for prediction parameters.
51
-
51
+
52
52
  Returns:
53
53
  pd.DataFrame: The DataFrame containing the predicted results.
54
54
  """
@@ -67,7 +67,7 @@ class ReplicateHandler(BaseMLEngine):
67
67
  output = replicate.run(
68
68
  f"{args['model_name']}:{args['version']}",
69
69
  input={**conditions.to_dict(), **pred_args} # Unpacking parameters inputted
70
- )
70
+ )
71
71
  # Process output based on the model type
72
72
  if isinstance(output, types.GeneratorType) and args.get('model_type') == 'LLM':
73
73
  output = ''.join(list(output)) # If model_type is LLM, make the stream a string
@@ -87,7 +87,7 @@ class ReplicateHandler(BaseMLEngine):
87
87
 
88
88
  if wrong_params:
89
89
  raise Exception(f"""'{wrong_params}' is/are not supported parameter for this model.
90
- Use DESCRIBE PREDICTOR mindsdb.<model_name>.features; to know about available parameters. OR
90
+ Use DESCRIBE PREDICTOR mindsdb.<model_name>.features; to know about available parameters. OR
91
91
  Visit https://replicate.com/{model_name}/versions/{version} to check parameters.""")
92
92
 
93
93
  # Set the Replicate API token for communication with the server
@@ -134,7 +134,7 @@ Visit https://replicate.com/{model_name}/versions/{version} to check parameters.
134
134
  return replicate_cfg['api_key']
135
135
 
136
136
  if strict:
137
- raise Exception(f'Missing API key "api_key". Either re-create this ML_ENGINE specifying the `api_key` parameter,\
137
+ raise Exception('Missing API key "api_key". Either re-create this ML_ENGINE specifying the `api_key` parameter,\
138
138
  or re-create this model and pass the API key with `USING` syntax.')
139
139
 
140
140
  def _get_schema(self, only_keys=False):
@@ -1,5 +1,4 @@
1
1
  import pandas as pd
2
- from typing import Dict, List
3
2
 
4
3
  from rocketchat_API.rocketchat import RocketChat
5
4
 
@@ -15,6 +14,7 @@ from mindsdb_sql_parser import parse_sql
15
14
 
16
15
  logger = log.getLogger(__name__)
17
16
 
17
+
18
18
  class RocketChatHandler(APIChatHandler):
19
19
  """A class for handling connections and interactions with the Rocket Chat API.
20
20
 
@@ -132,7 +132,6 @@ class RocketChatHandler(APIChatHandler):
132
132
  ast = parse_sql(query)
133
133
  return self.query(ast)
134
134
 
135
-
136
135
  def call_api(self, method_name: str = None, *args, **kwargs) -> pd.DataFrame:
137
136
  """Calls the Rocket Chat API method with the given params.
138
137
 
@@ -1,5 +1,3 @@
1
- from typing import List
2
-
3
1
  import pandas as pd
4
2
 
5
3
  from mindsdb.integrations.libs.api_handler import APITable
@@ -198,4 +196,3 @@ class UsersTable(APITable):
198
196
  'active',
199
197
  'type',
200
198
  ]
201
-
@@ -4,42 +4,42 @@ from mindsdb.integrations.libs.const import HANDLER_CONNECTION_ARG_TYPE as ARG_T
4
4
 
5
5
 
6
6
  connection_args = OrderedDict(
7
- user = {
7
+ user={
8
8
  'type': ARG_TYPE.STR,
9
9
  'description': 'Rockset user name'
10
10
  },
11
- password = {
11
+ password={
12
12
  'type': ARG_TYPE.PWD,
13
13
  'description': 'Rockset password',
14
14
  'secret': True
15
15
  },
16
- api_key = {
16
+ api_key={
17
17
  'type': ARG_TYPE.STR,
18
18
  'description': 'Rockset API key'
19
19
  },
20
- api_server = {
20
+ api_server={
21
21
  'type': ARG_TYPE.STR,
22
22
  'description': 'Rockset API server'
23
23
  },
24
- host = {
24
+ host={
25
25
  'type': ARG_TYPE.STR,
26
26
  'description': 'Rockset host'
27
27
  },
28
- port = {
28
+ port={
29
29
  'type': ARG_TYPE.INT,
30
30
  'description': 'Rockset port'
31
31
  },
32
- database = {
32
+ database={
33
33
  'type': ARG_TYPE.STR,
34
34
  'description': 'Rockset database'
35
35
  }
36
36
  )
37
37
  connection_args_example = OrderedDict(
38
- user = 'rockset',
39
- password = 'rockset',
40
- api_key = "adkjf234rksjfa23waejf2",
41
- api_server = 'api-us-west-2.rockset.io',
42
- host = 'localhost',
43
- port = '3306',
44
- database = 'test'
38
+ user='rockset',
39
+ password='rockset',
40
+ api_key="adkjf234rksjfa23waejf2",
41
+ api_server='api-us-west-2.rockset.io',
42
+ host='localhost',
43
+ port='3306',
44
+ database='test'
45
45
  )
@@ -2,6 +2,7 @@ import unittest
2
2
  from mindsdb.api.executor.data_types.response_type import RESPONSE_TYPE
3
3
  from mindsdb.integrations.handlers.rockset_handler.rockset_handler import RocksetHandler
4
4
 
5
+
5
6
  class RocksetHandlerTest(unittest.TestCase):
6
7
  @classmethod
7
8
  def setUpClass(cls):
@@ -22,6 +22,7 @@ from mindsdb.utilities import log
22
22
 
23
23
  logger = log.getLogger(__name__)
24
24
 
25
+
25
26
  class ScyllaHandler(DatabaseHandler):
26
27
  """
27
28
  This handler handles connection and execution of the Scylla statements.
@@ -35,17 +36,17 @@ class ScyllaHandler(DatabaseHandler):
35
36
  self.session = None
36
37
  self.is_connected = False
37
38
 
38
- def download_secure_bundle(self, url, max_size=10*1024*1024):
39
+ def download_secure_bundle(self, url, max_size=10 * 1024 * 1024):
39
40
  """
40
41
  Downloads the secure bundle from a given URL and stores it in a temporary file.
41
-
42
+
42
43
  :param url: URL of the secure bundle to be downloaded.
43
44
  :param max_size: Maximum allowable size of the bundle in bytes. Defaults to 10MB.
44
45
  :return: Path to the downloaded secure bundle saved as a temporary file.
45
46
  :raises ValueError: If the secure bundle size exceeds the allowed `max_size`.
46
-
47
+
47
48
  TODO:
48
- - Find a way to periodically clean up or delete the temporary files
49
+ - Find a way to periodically clean up or delete the temporary files
49
50
  after they have been used to prevent filling up storage over time.
50
51
  """
51
52
  response = requests.get(url, stream=True, timeout=10)
@@ -78,7 +79,7 @@ class ScyllaHandler(DatabaseHandler):
78
79
  username=self.connection_args['user'], password=self.connection_args['password']
79
80
  )
80
81
  else:
81
- raise ValueError("If authentication is required, both 'user' and 'password' must be provided!")
82
+ raise ValueError("If authentication is required, both 'user' and 'password' must be provided!")
82
83
 
83
84
  connection_props = {
84
85
  'auth_provider': auth_provider
@@ -11,6 +11,7 @@ from mindsdb_sql_parser import parse_sql
11
11
 
12
12
  logger = log.getLogger(__name__)
13
13
 
14
+
14
15
  class SendinblueHandler(APIHandler):
15
16
  """
16
17
  The Sendinblue handler implementation.
@@ -72,7 +73,7 @@ class SendinblueHandler(APIHandler):
72
73
  api_instance.get_account()
73
74
  response.success = True
74
75
  except Exception as e:
75
- logger.error(f'Error connecting to Sendinblue!')
76
+ logger.error('Error connecting to Sendinblue!')
76
77
  response.error_message = str(e)
77
78
 
78
79
  self.is_connected = response.success
@@ -2,13 +2,12 @@ import sib_api_v3_sdk
2
2
  import pandas as pd
3
3
 
4
4
 
5
- from typing import List, Optional, Dict, Text, Any
5
+ from typing import List, Dict, Text, Any
6
6
  from mindsdb.utilities import log
7
7
  from mindsdb.integrations.libs.api_handler import APITable
8
8
 
9
9
  from mindsdb_sql_parser import ast
10
10
  from sib_api_v3_sdk.rest import ApiException
11
- from datetime import datetime
12
11
 
13
12
 
14
13
  from mindsdb.integrations.utilities.handlers.query_utilities import (
@@ -180,6 +179,7 @@ class EmailCampaignsTable(APITable):
180
179
  raise RuntimeError(
181
180
  f"Failed to execute the update command for Email Campaign {campaign_id}"
182
181
  ) from e
182
+
183
183
  def insert(self, query: 'ast.Insert') -> None:
184
184
  """
185
185
  Inserts new email campaigns into Sendinblue.
@@ -196,23 +196,23 @@ class EmailCampaignsTable(APITable):
196
196
  Exception
197
197
  For any unexpected errors during the email campaign creation.
198
198
  """
199
- #this defines columns that are supported and mandatory for an INSERT operation.
199
+ # this defines columns that are supported and mandatory for an INSERT operation.
200
200
  supported_columns = [
201
- 'name', 'subject', 'sender_name', 'sender_email',
201
+ 'name', 'subject', 'sender_name', 'sender_email',
202
202
  'html_content', 'scheduled_at', 'recipients_lists', 'tag'
203
203
  ]
204
204
  mandatory_columns = ['name', 'subject', 'sender_name', 'sender_email', 'html_content']
205
205
 
206
- #this Parse the INSERT query to extract data.
206
+ # this Parse the INSERT query to extract data.
207
207
  insert_statement_parser = INSERTQueryParser(
208
- query, supported_columns=supported_columns,
208
+ query, supported_columns=supported_columns,
209
209
  mandatory_columns=mandatory_columns, all_mandatory=True
210
210
  )
211
211
  email_campaigns_data = insert_statement_parser.parse_query()
212
212
 
213
- #this processes each campaign data extracted from the query.
213
+ # this processes each campaign data extracted from the query.
214
214
  for email_campaign_data in email_campaigns_data:
215
- #this extracts and format sender information.
215
+ # this extracts and format sender information.
216
216
  sender_info = {}
217
217
  if 'sender_name' in email_campaign_data:
218
218
  sender_info['name'] = email_campaign_data.pop('sender_name')
@@ -227,7 +227,7 @@ class EmailCampaignsTable(APITable):
227
227
 
228
228
  email_campaign_data['sender'] = sender_info
229
229
 
230
- #this creates each email campaign.
230
+ # this creates each email campaign.
231
231
  self.create_email_campaign(email_campaign_data)
232
232
 
233
233
  def create_email_campaign(self, email_campaign_data: Dict[str, Any]) -> None:
@@ -244,33 +244,33 @@ class EmailCampaignsTable(APITable):
244
244
  Exception
245
245
  For any errors during the email campaign creation process.
246
246
  """
247
- #this establish a connection to the Sendinblue API.
247
+ # this establish a connection to the Sendinblue API.
248
248
  api_session = self.handler.connect()
249
249
  email_campaigns_api_instance = sib_api_v3_sdk.EmailCampaignsApi(api_session)
250
250
 
251
- #this logs the data for the email campaign being created.
251
+ # this logs the data for the email campaign being created.
252
252
  logger.info(f"Email campaign data before creating the object: {email_campaign_data}")
253
253
 
254
254
  try:
255
- #this creates the email campaign object and send it to Sendinblue.
255
+ # this creates the email campaign object and send it to Sendinblue.
256
256
  email_campaign = sib_api_v3_sdk.CreateEmailCampaign(**email_campaign_data)
257
257
  logger.info(f"Email campaign object after creation: {email_campaign}")
258
258
 
259
- #this executes the API call to create the campaign.
259
+ # this executes the API call to create the campaign.
260
260
  created_campaign = email_campaigns_api_instance.create_email_campaign(email_campaign)
261
261
 
262
- #this checks and log the response from the API.
262
+ # this checks and log the response from the API.
263
263
  if 'id' not in created_campaign.to_dict():
264
264
  logger.error('Email campaign creation failed')
265
265
  else:
266
266
  logger.info(f'Email Campaign {created_campaign.to_dict()["id"]} created')
267
267
  except ApiException as e:
268
- #this handles API exceptions and log the detailed response.
268
+ # this handles API exceptions and log the detailed response.
269
269
  logger.error(f"Exception when calling EmailCampaignsApi->create_email_campaign: {e}")
270
270
  if hasattr(e, 'body'):
271
271
  logger.error(f"Sendinblue API response body: {e.body}")
272
272
  raise Exception(f'Failed to create Email Campaign with data: {email_campaign_data}') from e
273
273
  except Exception as e:
274
- #this handles any other unexpected exceptions.
274
+ # this handles any other unexpected exceptions.
275
275
  logger.error(f"Unexpected error occurred: {e}")
276
276
  raise Exception(f'Unexpected error during Email Campaign creation: {e}') from e