MindsDB 25.5.3.0__py3-none-any.whl → 25.5.4.1__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 (313) hide show
  1. mindsdb/__about__.py +8 -8
  2. mindsdb/__main__.py +127 -79
  3. mindsdb/api/a2a/__init__.py +0 -0
  4. mindsdb/api/a2a/__main__.py +144 -0
  5. mindsdb/api/a2a/agent.py +308 -0
  6. mindsdb/api/a2a/common/__init__.py +0 -0
  7. mindsdb/api/a2a/common/server/__init__.py +4 -0
  8. mindsdb/api/a2a/common/server/server.py +164 -0
  9. mindsdb/api/a2a/common/server/task_manager.py +287 -0
  10. mindsdb/api/a2a/common/server/utils.py +28 -0
  11. mindsdb/api/a2a/common/types.py +365 -0
  12. mindsdb/api/a2a/constants.py +9 -0
  13. mindsdb/api/a2a/run_a2a.py +86 -0
  14. mindsdb/api/a2a/task_manager.py +560 -0
  15. mindsdb/api/executor/command_executor.py +185 -309
  16. mindsdb/api/executor/datahub/classes/response.py +5 -2
  17. mindsdb/api/executor/datahub/datanodes/integration_datanode.py +39 -72
  18. mindsdb/api/executor/planner/query_planner.py +10 -1
  19. mindsdb/api/executor/sql_query/result_set.py +185 -52
  20. mindsdb/api/executor/sql_query/sql_query.py +1 -1
  21. mindsdb/api/executor/sql_query/steps/apply_predictor_step.py +9 -12
  22. mindsdb/api/executor/sql_query/steps/fetch_dataframe.py +8 -10
  23. mindsdb/api/executor/sql_query/steps/fetch_dataframe_partition.py +5 -44
  24. mindsdb/api/executor/sql_query/steps/insert_step.py +24 -15
  25. mindsdb/api/executor/sql_query/steps/join_step.py +1 -1
  26. mindsdb/api/executor/sql_query/steps/project_step.py +1 -1
  27. mindsdb/api/executor/sql_query/steps/sql_steps.py +1 -1
  28. mindsdb/api/executor/sql_query/steps/subselect_step.py +4 -8
  29. mindsdb/api/executor/sql_query/steps/union_step.py +1 -3
  30. mindsdb/api/http/initialize.py +99 -83
  31. mindsdb/api/http/namespaces/analysis.py +3 -3
  32. mindsdb/api/http/namespaces/config.py +61 -86
  33. mindsdb/api/http/namespaces/file.py +8 -2
  34. mindsdb/api/http/namespaces/sql.py +13 -27
  35. mindsdb/api/mcp/start.py +42 -5
  36. mindsdb/api/mysql/mysql_proxy/data_types/mysql_packet.py +0 -1
  37. mindsdb/api/mysql/mysql_proxy/data_types/mysql_packets/binary_resultset_row_package.py +52 -19
  38. mindsdb/api/mysql/mysql_proxy/executor/mysql_executor.py +8 -10
  39. mindsdb/api/mysql/mysql_proxy/libs/constants/mysql.py +54 -38
  40. mindsdb/api/mysql/mysql_proxy/mysql_proxy.py +82 -115
  41. mindsdb/api/mysql/mysql_proxy/utilities/dump.py +351 -0
  42. mindsdb/api/postgres/postgres_proxy/executor/executor.py +1 -1
  43. mindsdb/api/postgres/postgres_proxy/postgres_proxy.py +5 -6
  44. mindsdb/integrations/handlers/altibase_handler/altibase_handler.py +26 -27
  45. mindsdb/integrations/handlers/altibase_handler/connection_args.py +13 -13
  46. mindsdb/integrations/handlers/altibase_handler/tests/test_altibase_handler.py +8 -8
  47. mindsdb/integrations/handlers/altibase_handler/tests/test_altibase_handler_dsn.py +13 -13
  48. mindsdb/integrations/handlers/anthropic_handler/__init__.py +2 -2
  49. mindsdb/integrations/handlers/anthropic_handler/anthropic_handler.py +1 -3
  50. mindsdb/integrations/handlers/aurora_handler/aurora_handler.py +1 -0
  51. mindsdb/integrations/handlers/autosklearn_handler/autosklearn_handler.py +1 -1
  52. mindsdb/integrations/handlers/autosklearn_handler/config.py +0 -1
  53. mindsdb/integrations/handlers/bigquery_handler/bigquery_handler.py +1 -1
  54. mindsdb/integrations/handlers/bigquery_handler/tests/test_bigquery_handler.py +1 -1
  55. mindsdb/integrations/handlers/binance_handler/binance_handler.py +1 -0
  56. mindsdb/integrations/handlers/binance_handler/binance_tables.py +3 -4
  57. mindsdb/integrations/handlers/byom_handler/__init__.py +0 -1
  58. mindsdb/integrations/handlers/byom_handler/requirements.txt +1 -2
  59. mindsdb/integrations/handlers/ckan_handler/ckan_handler.py +3 -0
  60. mindsdb/integrations/handlers/clickhouse_handler/__init__.py +1 -1
  61. mindsdb/integrations/handlers/cloud_spanner_handler/tests/test_cloud_spanner_handler.py +0 -2
  62. mindsdb/integrations/handlers/cloud_sql_handler/cloud_sql_handler.py +0 -1
  63. mindsdb/integrations/handlers/cohere_handler/__init__.py +1 -1
  64. mindsdb/integrations/handlers/cohere_handler/cohere_handler.py +11 -13
  65. mindsdb/integrations/handlers/confluence_handler/confluence_tables.py +6 -0
  66. mindsdb/integrations/handlers/databend_handler/connection_args.py +1 -1
  67. mindsdb/integrations/handlers/databend_handler/databend_handler.py +4 -4
  68. mindsdb/integrations/handlers/databend_handler/tests/__init__.py +0 -1
  69. mindsdb/integrations/handlers/databend_handler/tests/test_databend_handler.py +1 -1
  70. mindsdb/integrations/handlers/derby_handler/connection_args.py +1 -1
  71. mindsdb/integrations/handlers/derby_handler/derby_handler.py +14 -22
  72. mindsdb/integrations/handlers/derby_handler/tests/test_derby_handler.py +6 -6
  73. mindsdb/integrations/handlers/discord_handler/discord_handler.py +5 -5
  74. mindsdb/integrations/handlers/discord_handler/discord_tables.py +3 -3
  75. mindsdb/integrations/handlers/discord_handler/tests/test_discord.py +5 -3
  76. mindsdb/integrations/handlers/dockerhub_handler/dockerhub.py +3 -3
  77. mindsdb/integrations/handlers/dockerhub_handler/dockerhub_handler.py +2 -2
  78. mindsdb/integrations/handlers/dockerhub_handler/dockerhub_tables.py +57 -54
  79. mindsdb/integrations/handlers/dremio_handler/__init__.py +2 -2
  80. mindsdb/integrations/handlers/druid_handler/__init__.py +1 -1
  81. mindsdb/integrations/handlers/druid_handler/druid_handler.py +2 -2
  82. mindsdb/integrations/handlers/edgelessdb_handler/tests/test_edgelessdb_handler.py +9 -9
  83. mindsdb/integrations/handlers/email_handler/email_client.py +1 -1
  84. mindsdb/integrations/handlers/email_handler/email_ingestor.py +1 -1
  85. mindsdb/integrations/handlers/email_handler/email_tables.py +0 -1
  86. mindsdb/integrations/handlers/email_handler/settings.py +0 -1
  87. mindsdb/integrations/handlers/eventstoredb_handler/eventstoredb_handler.py +2 -1
  88. mindsdb/integrations/handlers/firebird_handler/firebird_handler.py +1 -1
  89. mindsdb/integrations/handlers/flaml_handler/flaml_handler.py +9 -9
  90. mindsdb/integrations/handlers/frappe_handler/frappe_client.py +5 -5
  91. mindsdb/integrations/handlers/frappe_handler/frappe_handler.py +6 -5
  92. mindsdb/integrations/handlers/frappe_handler/frappe_tables.py +2 -2
  93. mindsdb/integrations/handlers/github_handler/connection_args.py +2 -2
  94. mindsdb/integrations/handlers/github_handler/github_handler.py +1 -8
  95. mindsdb/integrations/handlers/github_handler/github_tables.py +13 -24
  96. mindsdb/integrations/handlers/gitlab_handler/gitlab_handler.py +2 -1
  97. mindsdb/integrations/handlers/gitlab_handler/gitlab_tables.py +1 -4
  98. mindsdb/integrations/handlers/gmail_handler/gmail_handler.py +6 -13
  99. mindsdb/integrations/handlers/google_books_handler/google_books_handler.py +2 -1
  100. mindsdb/integrations/handlers/google_books_handler/google_books_tables.py +0 -3
  101. mindsdb/integrations/handlers/google_calendar_handler/google_calendar_handler.py +4 -4
  102. mindsdb/integrations/handlers/google_calendar_handler/google_calendar_tables.py +2 -6
  103. mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_handler.py +3 -2
  104. mindsdb/integrations/handlers/google_content_shopping_handler/google_content_shopping_tables.py +0 -3
  105. mindsdb/integrations/handlers/google_fit_handler/google_fit_handler.py +10 -12
  106. mindsdb/integrations/handlers/google_fit_handler/google_fit_tables.py +11 -13
  107. mindsdb/integrations/handlers/google_search_handler/google_search_handler.py +2 -1
  108. mindsdb/integrations/handlers/google_search_handler/google_search_tables.py +0 -3
  109. mindsdb/integrations/handlers/groq_handler/__init__.py +3 -3
  110. mindsdb/integrations/handlers/hackernews_handler/hn_handler.py +5 -7
  111. mindsdb/integrations/handlers/hackernews_handler/hn_table.py +6 -7
  112. mindsdb/integrations/handlers/hive_handler/tests/test_hive_handler.py +1 -1
  113. mindsdb/integrations/handlers/hsqldb_handler/connection_args.py +6 -6
  114. mindsdb/integrations/handlers/hsqldb_handler/hsqldb_handler.py +4 -3
  115. mindsdb/integrations/handlers/huggingface_api_handler/exceptions.py +1 -1
  116. mindsdb/integrations/handlers/huggingface_api_handler/huggingface_api_handler.py +1 -8
  117. mindsdb/integrations/handlers/huggingface_handler/huggingface_handler.py +6 -6
  118. mindsdb/integrations/handlers/huggingface_handler/requirements.txt +1 -1
  119. mindsdb/integrations/handlers/huggingface_handler/requirements_cpu.txt +1 -1
  120. mindsdb/integrations/handlers/ignite_handler/ignite_handler.py +2 -1
  121. mindsdb/integrations/handlers/impala_handler/impala_handler.py +9 -12
  122. mindsdb/integrations/handlers/impala_handler/tests/test_impala_handler.py +11 -11
  123. mindsdb/integrations/handlers/influxdb_handler/influxdb_handler.py +10 -13
  124. mindsdb/integrations/handlers/influxdb_handler/influxdb_tables.py +20 -20
  125. mindsdb/integrations/handlers/informix_handler/__about__.py +8 -8
  126. mindsdb/integrations/handlers/informix_handler/__init__.py +12 -5
  127. mindsdb/integrations/handlers/informix_handler/informix_handler.py +99 -133
  128. mindsdb/integrations/handlers/informix_handler/tests/test_informix_handler.py +13 -11
  129. mindsdb/integrations/handlers/ingres_handler/__about__.py +0 -1
  130. mindsdb/integrations/handlers/ingres_handler/ingres_handler.py +1 -0
  131. mindsdb/integrations/handlers/jira_handler/jira_handler.py +4 -4
  132. mindsdb/integrations/handlers/jira_handler/jira_tables.py +9 -9
  133. mindsdb/integrations/handlers/kinetica_handler/__init__.py +0 -1
  134. mindsdb/integrations/handlers/lancedb_handler/requirements.txt +0 -1
  135. mindsdb/integrations/handlers/langchain_handler/langchain_handler.py +4 -4
  136. mindsdb/integrations/handlers/langchain_handler/tools.py +9 -10
  137. mindsdb/integrations/handlers/leonardoai_handler/__init__.py +1 -1
  138. mindsdb/integrations/handlers/lightwood_handler/functions.py +2 -2
  139. mindsdb/integrations/handlers/lightwood_handler/lightwood_handler.py +0 -1
  140. mindsdb/integrations/handlers/lightwood_handler/tests/test_lightwood_handler.py +11 -11
  141. mindsdb/integrations/handlers/litellm_handler/litellm_handler.py +37 -20
  142. mindsdb/integrations/handlers/llama_index_handler/llama_index_handler.py +4 -4
  143. mindsdb/integrations/handlers/llama_index_handler/settings.py +10 -9
  144. mindsdb/integrations/handlers/materialize_handler/tests/test_materialize_handler.py +8 -10
  145. mindsdb/integrations/handlers/matrixone_handler/matrixone_handler.py +4 -4
  146. mindsdb/integrations/handlers/matrixone_handler/tests/test_matrixone_handler.py +8 -9
  147. mindsdb/integrations/handlers/maxdb_handler/connection_args.py +25 -25
  148. mindsdb/integrations/handlers/maxdb_handler/maxdb_handler.py +1 -0
  149. mindsdb/integrations/handlers/mediawiki_handler/mediawiki_handler.py +3 -2
  150. mindsdb/integrations/handlers/mediawiki_handler/mediawiki_tables.py +1 -1
  151. mindsdb/integrations/handlers/mendeley_handler/__about__.py +1 -1
  152. mindsdb/integrations/handlers/mendeley_handler/__init__.py +2 -2
  153. mindsdb/integrations/handlers/mendeley_handler/mendeley_handler.py +48 -56
  154. mindsdb/integrations/handlers/mendeley_handler/mendeley_tables.py +24 -29
  155. mindsdb/integrations/handlers/mendeley_handler/tests/test_mendeley_handler.py +19 -17
  156. mindsdb/integrations/handlers/merlion_handler/merlion_handler.py +5 -4
  157. mindsdb/integrations/handlers/minds_endpoint_handler/__init__.py +3 -3
  158. mindsdb/integrations/handlers/mlflow_handler/mlflow_handler.py +58 -36
  159. mindsdb/integrations/handlers/monetdb_handler/__about__.py +8 -8
  160. mindsdb/integrations/handlers/monetdb_handler/__init__.py +15 -5
  161. mindsdb/integrations/handlers/monetdb_handler/connection_args.py +17 -18
  162. mindsdb/integrations/handlers/monetdb_handler/monetdb_handler.py +40 -57
  163. mindsdb/integrations/handlers/monetdb_handler/tests/test_monetdb_handler.py +7 -8
  164. mindsdb/integrations/handlers/monetdb_handler/utils/monet_get_id.py +13 -14
  165. mindsdb/integrations/handlers/monkeylearn_handler/__about__.py +1 -1
  166. mindsdb/integrations/handlers/monkeylearn_handler/__init__.py +1 -1
  167. mindsdb/integrations/handlers/monkeylearn_handler/monkeylearn_handler.py +2 -5
  168. mindsdb/integrations/handlers/ms_one_drive_handler/ms_graph_api_one_drive_client.py +1 -0
  169. mindsdb/integrations/handlers/ms_one_drive_handler/ms_one_drive_handler.py +1 -1
  170. mindsdb/integrations/handlers/ms_teams_handler/ms_graph_api_teams_client.py +23 -23
  171. mindsdb/integrations/handlers/ms_teams_handler/ms_teams_handler.py +3 -3
  172. mindsdb/integrations/handlers/ms_teams_handler/ms_teams_tables.py +10 -5
  173. mindsdb/integrations/handlers/mssql_handler/mssql_handler.py +73 -8
  174. mindsdb/integrations/handlers/mysql_handler/__about__.py +8 -8
  175. mindsdb/integrations/handlers/mysql_handler/__init__.py +15 -5
  176. mindsdb/integrations/handlers/mysql_handler/connection_args.py +43 -47
  177. mindsdb/integrations/handlers/mysql_handler/mysql_handler.py +101 -34
  178. mindsdb/integrations/handlers/mysql_handler/settings.py +15 -13
  179. mindsdb/integrations/handlers/neuralforecast_handler/neuralforecast_handler.py +1 -1
  180. mindsdb/integrations/handlers/newsapi_handler/newsapi_handler.py +1 -1
  181. mindsdb/integrations/handlers/newsapi_handler/tests/test_newsapi_handler.py +4 -4
  182. mindsdb/integrations/handlers/nuo_jdbc_handler/connection_args.py +2 -2
  183. mindsdb/integrations/handlers/nuo_jdbc_handler/nuo_jdbc_handler.py +28 -36
  184. mindsdb/integrations/handlers/nuo_jdbc_handler/tests/test_nuo_handler.py +5 -5
  185. mindsdb/integrations/handlers/oceanbase_handler/oceanbase_handler.py +0 -1
  186. mindsdb/integrations/handlers/oceanbase_handler/tests/test_oceanbase_handler.py +8 -10
  187. mindsdb/integrations/handlers/ollama_handler/ollama_handler.py +3 -3
  188. mindsdb/integrations/handlers/opengauss_handler/tests/test_opengauss_handler.py +1 -2
  189. mindsdb/integrations/handlers/openstreetmap_handler/__init__.py +7 -7
  190. mindsdb/integrations/handlers/oracle_handler/connection_args.py +6 -0
  191. mindsdb/integrations/handlers/oracle_handler/oracle_handler.py +77 -11
  192. mindsdb/integrations/handlers/orioledb_handler/tests/test_orioledb_handler.py +8 -10
  193. mindsdb/integrations/handlers/palm_handler/__about__.py +1 -1
  194. mindsdb/integrations/handlers/palm_handler/__init__.py +1 -1
  195. mindsdb/integrations/handlers/palm_handler/palm_handler.py +1 -3
  196. mindsdb/integrations/handlers/paypal_handler/paypal_handler.py +2 -2
  197. mindsdb/integrations/handlers/paypal_handler/paypal_tables.py +15 -14
  198. mindsdb/integrations/handlers/pgvector_handler/pgvector_handler.py +53 -10
  199. mindsdb/integrations/handlers/phoenix_handler/__init__.py +1 -1
  200. mindsdb/integrations/handlers/phoenix_handler/phoenix_handler.py +1 -0
  201. mindsdb/integrations/handlers/pinot_handler/__init__.py +1 -1
  202. mindsdb/integrations/handlers/pinot_handler/pinot_handler.py +3 -2
  203. mindsdb/integrations/handlers/plaid_handler/plaid_handler.py +13 -13
  204. mindsdb/integrations/handlers/plaid_handler/plaid_tables.py +10 -12
  205. mindsdb/integrations/handlers/plaid_handler/utils.py +4 -6
  206. mindsdb/integrations/handlers/planetscale_handler/planetscale_handler.py +1 -4
  207. mindsdb/integrations/handlers/portkey_handler/__init__.py +2 -2
  208. mindsdb/integrations/handlers/postgres_handler/postgres_handler.py +105 -24
  209. mindsdb/integrations/handlers/postgres_handler/tests/test_postgres_handler.py +11 -6
  210. mindsdb/integrations/handlers/questdb_handler/questdb_handler.py +1 -2
  211. mindsdb/integrations/handlers/questdb_handler/tests/test_questdb_handler.py +2 -3
  212. mindsdb/integrations/handlers/quickbooks_handler/quickbooks_handler.py +6 -8
  213. mindsdb/integrations/handlers/quickbooks_handler/quickbooks_table.py +10 -10
  214. mindsdb/integrations/handlers/rag_handler/ingest.py +2 -2
  215. mindsdb/integrations/handlers/rag_handler/rag_handler.py +1 -1
  216. mindsdb/integrations/handlers/rag_handler/settings.py +1 -1
  217. mindsdb/integrations/handlers/reddit_handler/reddit_handler.py +2 -7
  218. mindsdb/integrations/handlers/reddit_handler/reddit_tables.py +2 -3
  219. mindsdb/integrations/handlers/replicate_handler/replicate_handler.py +6 -6
  220. mindsdb/integrations/handlers/rocket_chat_handler/rocket_chat_handler.py +1 -2
  221. mindsdb/integrations/handlers/rocket_chat_handler/rocket_chat_tables.py +0 -3
  222. mindsdb/integrations/handlers/rockset_handler/connection_args.py +14 -14
  223. mindsdb/integrations/handlers/rockset_handler/tests/test_rockset_handler.py +1 -0
  224. mindsdb/integrations/handlers/scylla_handler/scylla_handler.py +6 -5
  225. mindsdb/integrations/handlers/sendinblue_handler/sendinblue_handler.py +2 -1
  226. mindsdb/integrations/handlers/sendinblue_handler/sendinblue_tables.py +16 -16
  227. mindsdb/integrations/handlers/sentence_transformers_handler/__init__.py +1 -1
  228. mindsdb/integrations/handlers/sheets_handler/connection_args.py +1 -1
  229. mindsdb/integrations/handlers/shopify_handler/shopify_handler.py +7 -6
  230. mindsdb/integrations/handlers/shopify_handler/shopify_tables.py +38 -41
  231. mindsdb/integrations/handlers/singlestore_handler/__about__.py +1 -1
  232. mindsdb/integrations/handlers/singlestore_handler/__init__.py +0 -1
  233. mindsdb/integrations/handlers/singlestore_handler/singlestore_handler.py +1 -0
  234. mindsdb/integrations/handlers/singlestore_handler/tests/test_singlestore_handler.py +3 -3
  235. mindsdb/integrations/handlers/slack_handler/__init__.py +3 -3
  236. mindsdb/integrations/handlers/snowflake_handler/snowflake_handler.py +100 -6
  237. mindsdb/integrations/handlers/solr_handler/connection_args.py +7 -7
  238. mindsdb/integrations/handlers/solr_handler/solr_handler.py +2 -1
  239. mindsdb/integrations/handlers/solr_handler/tests/test_solr_handler.py +2 -1
  240. mindsdb/integrations/handlers/sqlany_handler/sqlany_handler.py +3 -2
  241. mindsdb/integrations/handlers/sqlite_handler/sqlite_handler.py +1 -0
  242. mindsdb/integrations/handlers/sqreamdb_handler/connection_args.py +1 -1
  243. mindsdb/integrations/handlers/sqreamdb_handler/sqreamdb_handler.py +15 -20
  244. mindsdb/integrations/handlers/sqreamdb_handler/tests/test_sqreamdb_handler.py +4 -4
  245. mindsdb/integrations/handlers/stabilityai_handler/__init__.py +1 -1
  246. mindsdb/integrations/handlers/starrocks_handler/starrocks_handler.py +0 -1
  247. mindsdb/integrations/handlers/starrocks_handler/tests/test_starrocks_handler.py +8 -10
  248. mindsdb/integrations/handlers/statsforecast_handler/statsforecast_handler.py +2 -2
  249. mindsdb/integrations/handlers/strava_handler/strava_handler.py +4 -8
  250. mindsdb/integrations/handlers/strava_handler/strava_tables.py +22 -30
  251. mindsdb/integrations/handlers/stripe_handler/stripe_handler.py +3 -2
  252. mindsdb/integrations/handlers/stripe_handler/stripe_tables.py +11 -27
  253. mindsdb/integrations/handlers/supabase_handler/tests/test_supabase_handler.py +1 -1
  254. mindsdb/integrations/handlers/surrealdb_handler/surrealdb_handler.py +4 -4
  255. mindsdb/integrations/handlers/tdengine_handler/tdengine_handler.py +25 -27
  256. mindsdb/integrations/handlers/tdengine_handler/tests/test_tdengine_handler.py +8 -8
  257. mindsdb/integrations/handlers/tidb_handler/tests/test_tidb_handler.py +1 -2
  258. mindsdb/integrations/handlers/timegpt_handler/timegpt_handler.py +5 -5
  259. mindsdb/integrations/handlers/tpot_handler/tpot_handler.py +21 -26
  260. mindsdb/integrations/handlers/trino_handler/trino_handler.py +14 -14
  261. mindsdb/integrations/handlers/twitter_handler/twitter_handler.py +2 -4
  262. mindsdb/integrations/handlers/unify_handler/tests/test_unify_handler.py +7 -8
  263. mindsdb/integrations/handlers/unify_handler/unify_handler.py +9 -9
  264. mindsdb/integrations/handlers/vertex_handler/vertex_client.py +1 -1
  265. mindsdb/integrations/handlers/vertica_handler/tests/test_vertica_handler.py +11 -11
  266. mindsdb/integrations/handlers/vertica_handler/vertica_handler.py +11 -14
  267. mindsdb/integrations/handlers/vitess_handler/tests/test_vitess_handler.py +9 -11
  268. mindsdb/integrations/handlers/vitess_handler/vitess_handler.py +0 -1
  269. mindsdb/integrations/handlers/web_handler/web_handler.py +1 -0
  270. mindsdb/integrations/handlers/whatsapp_handler/__init__.py +3 -3
  271. mindsdb/integrations/handlers/writer_handler/evaluate.py +1 -1
  272. mindsdb/integrations/handlers/writer_handler/settings.py +0 -1
  273. mindsdb/integrations/handlers/writer_handler/writer_handler.py +1 -0
  274. mindsdb/integrations/handlers/youtube_handler/youtube_handler.py +5 -5
  275. mindsdb/integrations/handlers/youtube_handler/youtube_tables.py +26 -27
  276. mindsdb/integrations/handlers/yugabyte_handler/tests/test_yugabyte_handler.py +3 -3
  277. mindsdb/integrations/handlers/yugabyte_handler/yugabyte_handler.py +0 -6
  278. mindsdb/integrations/libs/llm/config.py +13 -0
  279. mindsdb/integrations/libs/llm/utils.py +37 -65
  280. mindsdb/integrations/libs/response.py +67 -52
  281. mindsdb/integrations/libs/vectordatabase_handler.py +6 -0
  282. mindsdb/integrations/utilities/handler_utils.py +15 -3
  283. mindsdb/integrations/utilities/handlers/api_utilities/__init__.py +0 -1
  284. mindsdb/integrations/utilities/handlers/auth_utilities/__init__.py +0 -2
  285. mindsdb/integrations/utilities/rag/rerankers/base_reranker.py +230 -227
  286. mindsdb/integrations/utilities/utils.py +3 -3
  287. mindsdb/interfaces/agents/agents_controller.py +164 -1
  288. mindsdb/interfaces/agents/constants.py +32 -13
  289. mindsdb/interfaces/agents/langchain_agent.py +106 -95
  290. mindsdb/interfaces/agents/mindsdb_database_agent.py +101 -2
  291. mindsdb/interfaces/knowledge_base/controller.py +250 -216
  292. mindsdb/interfaces/knowledge_base/preprocessing/document_preprocessor.py +13 -10
  293. mindsdb/interfaces/knowledge_base/preprocessing/json_chunker.py +434 -0
  294. mindsdb/interfaces/knowledge_base/preprocessing/models.py +54 -0
  295. mindsdb/interfaces/query_context/context_controller.py +66 -10
  296. mindsdb/interfaces/skills/custom/text2sql/mindsdb_kb_tools.py +190 -0
  297. mindsdb/interfaces/skills/custom/text2sql/mindsdb_sql_toolkit.py +92 -0
  298. mindsdb/interfaces/skills/skill_tool.py +202 -57
  299. mindsdb/interfaces/skills/sql_agent.py +205 -17
  300. mindsdb/interfaces/storage/fs.py +1 -0
  301. mindsdb/interfaces/variables/__init__.py +0 -0
  302. mindsdb/interfaces/variables/variables_controller.py +97 -0
  303. mindsdb/migrations/env.py +5 -7
  304. mindsdb/migrations/migrate.py +47 -7
  305. mindsdb/migrations/versions/2025-05-21_9f150e4f9a05_checkpoint_1.py +360 -0
  306. mindsdb/utilities/config.py +287 -216
  307. mindsdb/utilities/starters.py +13 -0
  308. {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.1.dist-info}/METADATA +646 -698
  309. {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.1.dist-info}/RECORD +312 -295
  310. {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.1.dist-info}/WHEEL +1 -1
  311. mindsdb/integrations/handlers/monkeylearn_handler/requirements.txt +0 -1
  312. {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.1.dist-info}/licenses/LICENSE +0 -0
  313. {mindsdb-25.5.3.0.dist-info → mindsdb-25.5.4.1.dist-info}/top_level.txt +0 -0
@@ -34,6 +34,7 @@ from mindsdb_sql_parser.ast import (
34
34
  Use,
35
35
  Tuple,
36
36
  Function,
37
+ Variable,
37
38
  )
38
39
 
39
40
  # typed models
@@ -49,6 +50,7 @@ from mindsdb_sql_parser.ast.mindsdb import (
49
50
  CreateSkill,
50
51
  CreateTrigger,
51
52
  CreateView,
53
+ CreateKnowledgeBaseIndex,
52
54
  DropAgent,
53
55
  DropChatBot,
54
56
  DropDatasource,
@@ -63,7 +65,7 @@ from mindsdb_sql_parser.ast.mindsdb import (
63
65
  RetrainPredictor,
64
66
  UpdateAgent,
65
67
  UpdateChatBot,
66
- UpdateSkill
68
+ UpdateSkill,
67
69
  )
68
70
 
69
71
  import mindsdb.utilities.profiler as profiler
@@ -101,6 +103,7 @@ from mindsdb.interfaces.model.functions import (
101
103
  )
102
104
  from mindsdb.interfaces.query_context.context_controller import query_context_controller
103
105
  from mindsdb.interfaces.triggers.triggers_controller import TriggersController
106
+ from mindsdb.interfaces.variables.variables_controller import variables_controller
104
107
  from mindsdb.utilities.context import context as ctx
105
108
  from mindsdb.utilities.functions import mark_process, resolve_model_identifier, get_handler_install_message
106
109
  from mindsdb.utilities.exception import EntityExistsError, EntityNotExistsError
@@ -137,18 +140,12 @@ def _get_show_where(
137
140
  )
138
141
  )
139
142
  if statement.like is not None and like_name is not None:
140
- where.append(
141
- BinaryOperation(
142
- "like", args=[Identifier(like_name), Constant(statement.like)]
143
- )
144
- )
143
+ where.append(BinaryOperation("like", args=[Identifier(like_name), Constant(statement.like)]))
145
144
  if statement.where is not None:
146
145
  where.append(statement.where)
147
146
 
148
147
  if len(where) > 0:
149
- return reduce(
150
- lambda prev, next: BinaryOperation("and", args=[prev, next]), where
151
- )
148
+ return reduce(lambda prev, next: BinaryOperation("and", args=[prev, next]), where)
152
149
  return None
153
150
 
154
151
 
@@ -181,7 +178,7 @@ class ExecuteCommands:
181
178
  name,
182
179
  handler=statement.handler,
183
180
  params=statement.params,
184
- if_not_exists=getattr(statement, "if_not_exists", False)
181
+ if_not_exists=getattr(statement, "if_not_exists", False),
185
182
  )
186
183
  elif statement_type is DropMLEngine:
187
184
  return self.answer_drop_ml_engine(statement)
@@ -196,7 +193,7 @@ class ExecuteCommands:
196
193
  # NOTE in sql 'describe table' is same as 'show columns'
197
194
  obj_type = statement.type
198
195
 
199
- if obj_type is None or obj_type.upper() in ('MODEL', 'PREDICTOR'):
196
+ if obj_type is None or obj_type.upper() in ("MODEL", "PREDICTOR"):
200
197
  return self.answer_describe_predictor(statement.value, database_name)
201
198
  else:
202
199
  return self.answer_describe_object(obj_type.upper(), statement.value, database_name)
@@ -231,9 +228,7 @@ class ExecuteCommands:
231
228
  return self.answer_select(query)
232
229
  elif sql_category == "plugins":
233
230
  if statement.where is not None or statement.like:
234
- raise ExecutorException(
235
- "'SHOW PLUGINS' query should be used without filters"
236
- )
231
+ raise ExecutorException("'SHOW PLUGINS' query should be used without filters")
237
232
  new_statement = Select(
238
233
  targets=[Star()],
239
234
  from_table=Identifier(parts=["information_schema", "PLUGINS"]),
@@ -259,10 +254,7 @@ class ExecuteCommands:
259
254
  return self.answer_select(query)
260
255
  elif sql_category in ("tables", "full tables"):
261
256
  schema = database_name or "mindsdb"
262
- if (
263
- statement.from_table is not None
264
- and statement.in_table is not None
265
- ):
257
+ if statement.from_table is not None and statement.in_table is not None:
266
258
  raise ExecutorException(
267
259
  "You have an error in your SQL syntax: 'from' and 'in' cannot be used together"
268
260
  )
@@ -274,13 +266,13 @@ class ExecuteCommands:
274
266
  schema = statement.in_table.parts[-1]
275
267
  statement.in_table = None
276
268
 
277
- table_types = [Constant(t) for t in ['MODEL', 'BASE TABLE', 'SYSTEM VIEW', 'VIEW']]
269
+ table_types = [Constant(t) for t in ["MODEL", "BASE TABLE", "SYSTEM VIEW", "VIEW"]]
278
270
  where = BinaryOperation(
279
271
  "and",
280
272
  args=[
281
273
  BinaryOperation("=", args=[Identifier("table_schema"), Constant(schema)]),
282
- BinaryOperation("in", args=[Identifier("table_type"), Tuple(table_types)])
283
- ]
274
+ BinaryOperation("in", args=[Identifier("table_type"), Tuple(table_types)]),
275
+ ],
284
276
  )
285
277
 
286
278
  new_statement = Select(
@@ -291,15 +283,11 @@ class ExecuteCommands:
291
283
  )
292
284
  ],
293
285
  from_table=Identifier(parts=["information_schema", "TABLES"]),
294
- where=_get_show_where(
295
- statement, like_name=f"Tables_in_{schema}", initial=where
296
- ),
286
+ where=_get_show_where(statement, like_name=f"Tables_in_{schema}", initial=where),
297
287
  )
298
288
 
299
289
  if "FULL" in statement.modes:
300
- new_statement.targets.append(
301
- Identifier(parts=["TABLE_TYPE"], alias=Identifier("Table_type"))
302
- )
290
+ new_statement.targets.append(Identifier(parts=["TABLE_TYPE"], alias=Identifier("Table_type")))
303
291
 
304
292
  query = SQLQuery(new_statement, session=self.session, database=database_name)
305
293
  return self.answer_select(query)
@@ -324,9 +312,7 @@ class ExecuteCommands:
324
312
  var_name = var_name.replace("@@", "")
325
313
  if is_session and var_name.startswith("session.") is False:
326
314
  continue
327
- if var_name.startswith("session.") or var_name.startswith(
328
- "GLOBAL."
329
- ):
315
+ if var_name.startswith("session.") or var_name.startswith("GLOBAL."):
330
316
  name = var_name.replace("session.", "").replace("GLOBAL.", "")
331
317
  data[name] = var_data[0]
332
318
  elif var_name not in data:
@@ -335,28 +321,20 @@ class ExecuteCommands:
335
321
  df = pd.DataFrame(data.items(), columns=["Variable_name", "Value"])
336
322
  df2 = query_df(df, new_statement)
337
323
 
338
- return ExecuteAnswer(
339
- data=ResultSet().from_df(df2, table_name="session_variables")
340
- )
324
+ return ExecuteAnswer(data=ResultSet.from_df(df2, table_name="session_variables"))
341
325
  elif sql_category == "search_path":
342
326
  return ExecuteAnswer(
343
327
  data=ResultSet(
344
- columns=[
345
- Column(name="search_path", table_name="search_path", type="str")
346
- ],
347
- values=[['"$user", public']]
328
+ columns=[Column(name="search_path", table_name="search_path", type="str")],
329
+ values=[['"$user", public']],
348
330
  )
349
331
  )
350
332
  elif "show status like 'ssl_version'" in sql_lower:
351
333
  return ExecuteAnswer(
352
334
  data=ResultSet(
353
335
  columns=[
354
- Column(
355
- name="Value", table_name="session_variables", type="str"
356
- ),
357
- Column(
358
- name="Value", table_name="session_variables", type="str"
359
- ),
336
+ Column(name="Value", table_name="session_variables", type="str"),
337
+ Column(name="Value", table_name="session_variables", type="str"),
360
338
  ],
361
339
  values=[["Ssl_version", "TLSv1.1"]],
362
340
  )
@@ -395,23 +373,17 @@ class ExecuteCommands:
395
373
  # FIXME if have answer on that request, then DataGrip show warning '[S0022] Column 'Non_unique' not found.'
396
374
  elif "show create table" in sql_lower:
397
375
  # SHOW CREATE TABLE `MINDSDB`.`predictors`
398
- table = sql[sql.rfind(".") + 1:].strip(" .;\n\t").replace("`", "")
376
+ table = sql[sql.rfind(".") + 1 :].strip(" .;\n\t").replace("`", "")
399
377
  return self.answer_show_create_table(table)
400
378
  elif sql_category in ("character set", "charset"):
401
379
  new_statement = Select(
402
380
  targets=[
403
381
  Identifier("CHARACTER_SET_NAME", alias=Identifier("Charset")),
404
- Identifier(
405
- "DEFAULT_COLLATE_NAME", alias=Identifier("Description")
406
- ),
407
- Identifier(
408
- "DESCRIPTION", alias=Identifier("Default collation")
409
- ),
382
+ Identifier("DEFAULT_COLLATE_NAME", alias=Identifier("Description")),
383
+ Identifier("DESCRIPTION", alias=Identifier("Default collation")),
410
384
  Identifier("MAXLEN", alias=Identifier("Maxlen")),
411
385
  ],
412
- from_table=Identifier(
413
- parts=["INFORMATION_SCHEMA", "CHARACTER_SETS"]
414
- ),
386
+ from_table=Identifier(parts=["INFORMATION_SCHEMA", "CHARACTER_SETS"]),
415
387
  where=_get_show_where(statement, like_name="CHARACTER_SET_NAME"),
416
388
  )
417
389
  query = SQLQuery(new_statement, session=self.session, database=database_name)
@@ -464,9 +436,18 @@ class ExecuteCommands:
464
436
  database_name=database_name,
465
437
  )
466
438
 
467
- elif sql_category in ("agents", "jobs", "skills", "chatbots", "triggers", "views",
468
- "knowledge_bases", "knowledge bases", "predictors", "models"):
469
-
439
+ elif sql_category in (
440
+ "agents",
441
+ "jobs",
442
+ "skills",
443
+ "chatbots",
444
+ "triggers",
445
+ "views",
446
+ "knowledge_bases",
447
+ "knowledge bases",
448
+ "predictors",
449
+ "models",
450
+ ):
470
451
  if sql_category == "knowledge bases":
471
452
  sql_category = "knowledge_bases"
472
453
 
@@ -477,25 +458,21 @@ class ExecuteCommands:
477
458
  if statement.from_table is not None:
478
459
  db_name = statement.from_table.parts[-1]
479
460
 
480
- where = BinaryOperation(op='=', args=[Identifier('project'), Constant(db_name)])
461
+ where = BinaryOperation(op="=", args=[Identifier("project"), Constant(db_name)])
481
462
 
482
463
  select_statement = Select(
483
464
  targets=[Star()],
484
- from_table=Identifier(
485
- parts=["information_schema", sql_category]
486
- ),
465
+ from_table=Identifier(parts=["information_schema", sql_category]),
487
466
  where=_get_show_where(statement, like_name="name", initial=where),
488
467
  )
489
468
  query = SQLQuery(select_statement, session=self.session)
490
469
  return self.answer_select(query)
491
470
 
492
471
  elif sql_category == "projects":
493
- where = BinaryOperation(op='=', args=[Identifier('type'), Constant('project')])
472
+ where = BinaryOperation(op="=", args=[Identifier("type"), Constant("project")])
494
473
  select_statement = Select(
495
- targets=[Identifier(parts=["NAME"], alias=Identifier('project'))],
496
- from_table=Identifier(
497
- parts=["information_schema", "DATABASES"]
498
- ),
474
+ targets=[Identifier(parts=["NAME"], alias=Identifier("project"))],
475
+ from_table=Identifier(parts=["information_schema", "DATABASES"]),
499
476
  where=_get_show_where(statement, like_name="project", from_name="project", initial=where),
500
477
  )
501
478
 
@@ -511,28 +488,30 @@ class ExecuteCommands:
511
488
  return ExecuteAnswer()
512
489
  elif statement_type is Set:
513
490
  category = (statement.category or "").lower()
514
- if category == "" and isinstance(statement.name, Identifier):
515
- param = statement.name.parts[0].lower()
516
-
517
- value = None
518
- if isinstance(statement.value, Constant):
519
- value = statement.value.value
520
-
521
- if param == "profiling":
522
- self.session.profiling = value in (1, True)
523
- if self.session.profiling is True:
524
- profiler.enable()
525
- else:
526
- profiler.disable()
527
- elif param == "predictor_cache":
528
- self.session.predictor_cache = value in (1, True)
529
- elif param == "context":
530
- if value in (0, False, None):
531
- # drop context
532
- query_context_controller.drop_query_context(None)
533
- elif param == "show_secrets":
534
- self.session.show_secrets = value in (1, True)
535
-
491
+ if category == "":
492
+ if isinstance(statement.name, Identifier):
493
+ param = statement.name.parts[0].lower()
494
+
495
+ value = None
496
+ if isinstance(statement.value, Constant):
497
+ value = statement.value.value
498
+
499
+ if param == "profiling":
500
+ self.session.profiling = value in (1, True)
501
+ if self.session.profiling is True:
502
+ profiler.enable()
503
+ else:
504
+ profiler.disable()
505
+ elif param == "predictor_cache":
506
+ self.session.predictor_cache = value in (1, True)
507
+ elif param == "context":
508
+ if value in (0, False, None):
509
+ # drop context
510
+ query_context_controller.drop_query_context(None)
511
+ elif param == "show_secrets":
512
+ self.session.show_secrets = value in (1, True)
513
+ elif isinstance(statement.name, Variable):
514
+ variables_controller.set_variable(statement.name.value, statement.value)
536
515
  return ExecuteAnswer()
537
516
  elif category == "autocommit":
538
517
  return ExecuteAnswer()
@@ -560,9 +539,7 @@ class ExecuteCommands:
560
539
  return self.answer_update_model_version(statement.value, database_name)
561
540
 
562
541
  else:
563
- logger.warning(
564
- f"SQL statement is not processable, return OK package: {sql}"
565
- )
542
+ logger.warning(f"SQL statement is not processable, return OK package: {sql}")
566
543
  return ExecuteAnswer()
567
544
  elif statement_type is Use:
568
545
  db_name = statement.value.parts[-1]
@@ -579,26 +556,16 @@ class ExecuteCommands:
579
556
  return self.answer_drop_view(statement, database_name)
580
557
  elif statement_type is Delete:
581
558
  query = SQLQuery(statement, session=self.session, database=database_name)
582
- return ExecuteAnswer(
583
- affected_rows=query.fetched_data.affected_rows
584
- )
559
+ return ExecuteAnswer(affected_rows=query.fetched_data.affected_rows)
585
560
  elif statement_type is Insert:
586
561
  query = SQLQuery(statement, session=self.session, database=database_name)
587
562
  if query.fetched_data.length() > 0:
588
563
  return self.answer_select(query)
589
- return ExecuteAnswer(
590
- affected_rows=query.fetched_data.affected_rows
591
- )
564
+ return ExecuteAnswer(affected_rows=query.fetched_data.affected_rows)
592
565
  elif statement_type is Update:
593
566
  query = SQLQuery(statement, session=self.session, database=database_name)
594
- return ExecuteAnswer(
595
- affected_rows=query.fetched_data.affected_rows
596
- )
597
- elif (
598
- statement_type is Alter
599
- and ("disable keys" in sql_lower)
600
- or ("enable keys" in sql_lower)
601
- ):
567
+ return ExecuteAnswer(affected_rows=query.fetched_data.affected_rows)
568
+ elif statement_type is Alter and ("disable keys" in sql_lower) or ("enable keys" in sql_lower):
602
569
  return ExecuteAnswer()
603
570
  elif statement_type is Select:
604
571
  ret = self.exec_service_function(statement, database_name)
@@ -649,6 +616,8 @@ class ExecuteCommands:
649
616
  elif statement_type is Evaluate:
650
617
  statement.data = parse_sql(statement.query_str)
651
618
  return self.answer_evaluate_metric(statement, database_name)
619
+ elif statement_type is CreateKnowledgeBaseIndex:
620
+ return self.answer_create_kb_index(statement, database_name)
652
621
  else:
653
622
  logger.warning(f"Unknown SQL statement: {sql}")
654
623
  raise NotSupportedYet(f"Unknown SQL statement: {sql}")
@@ -670,11 +639,11 @@ class ExecuteCommands:
670
639
 
671
640
  command = target.op.lower()
672
641
  args = [arg.value for arg in target.args if isinstance(arg, Constant)]
673
- if command == 'query_resume':
642
+ if command == "query_resume":
674
643
  ret = SQLQuery(None, session=self.session, query_id=args[0])
675
644
  return self.answer_select(ret)
676
645
 
677
- elif command == 'query_cancel':
646
+ elif command == "query_cancel":
678
647
  query_context_controller.cancel_query(*args)
679
648
  return ExecuteAnswer()
680
649
 
@@ -815,25 +784,17 @@ class ExecuteCommands:
815
784
  def answer_evaluate_metric(self, statement, database_name):
816
785
  # heavy import, so we do it here on-demand
817
786
  from mindsdb_evaluator.accuracy.general import evaluate_accuracy
787
+
818
788
  try:
819
789
  sqlquery = SQLQuery(statement.data, session=self.session, database=database_name)
820
790
  except Exception as e:
821
- raise Exception(
822
- f'Nested query failed to execute with error: "{e}", please check and try again.'
823
- )
791
+ raise Exception(f'Nested query failed to execute with error: "{e}", please check and try again.')
824
792
  df = sqlquery.fetched_data.to_df()
825
- df.columns = [
826
- str(t.alias) if hasattr(t, "alias") else str(t.parts[-1])
827
- for t in statement.data.targets
828
- ]
793
+ df.columns = [str(t.alias) if hasattr(t, "alias") else str(t.parts[-1]) for t in statement.data.targets]
829
794
 
830
795
  for col in ["actual", "prediction"]:
831
- assert (
832
- col in df.columns
833
- ), f"`{col}` column was not provided, please try again."
834
- assert (
835
- df[col].isna().sum() == 0
836
- ), f"There are missing values in the `{col}` column, please try again."
796
+ assert col in df.columns, f"`{col}` column was not provided, please try again."
797
+ assert df[col].isna().sum() == 0, f"There are missing values in the `{col}` column, please try again."
837
798
 
838
799
  metric_name = statement.name.parts[-1]
839
800
  target_series = df.pop("prediction")
@@ -854,9 +815,17 @@ class ExecuteCommands:
854
815
  )
855
816
 
856
817
  def answer_describe_object(self, obj_type: str, obj_name: Identifier, database_name: str):
857
-
858
- project_objects = ("AGENTS", "JOBS", "SKILLS", "CHATBOTS", "TRIGGERS", "VIEWS",
859
- "KNOWLEDGE_BASES", "PREDICTORS", "MODELS")
818
+ project_objects = (
819
+ "AGENTS",
820
+ "JOBS",
821
+ "SKILLS",
822
+ "CHATBOTS",
823
+ "TRIGGERS",
824
+ "VIEWS",
825
+ "KNOWLEDGE_BASES",
826
+ "PREDICTORS",
827
+ "MODELS",
828
+ )
860
829
 
861
830
  global_objects = ("DATABASES", "PROJECTS", "HANDLERS", "ML_ENGINES")
862
831
 
@@ -864,39 +833,31 @@ class ExecuteCommands:
864
833
 
865
834
  # is not plural?
866
835
  if obj_type not in all_objects:
867
- if obj_type + 'S' in all_objects:
868
- obj_type = obj_type + 'S'
869
- elif obj_type + 'ES' in all_objects:
870
- obj_type = obj_type + 'ES'
836
+ if obj_type + "S" in all_objects:
837
+ obj_type = obj_type + "S"
838
+ elif obj_type + "ES" in all_objects:
839
+ obj_type = obj_type + "ES"
871
840
  else:
872
- raise WrongArgumentError(f'Unknown describe type: {obj_type}')
841
+ raise WrongArgumentError(f"Unknown describe type: {obj_type}")
873
842
 
874
843
  parts = obj_name.parts
875
844
  if len(parts) > 2:
876
845
  raise WrongArgumentError(
877
- f"Invalid object name: {obj_name.to_string()}.\n"
878
- "Only models support three-part namespaces."
846
+ f"Invalid object name: {obj_name.to_string()}.\nOnly models support three-part namespaces."
879
847
  )
880
848
 
881
849
  name = parts[-1]
882
- where = BinaryOperation(op='=', args=[
883
- Identifier('name'),
884
- Constant(name)
885
- ])
850
+ where = BinaryOperation(op="=", args=[Identifier("name"), Constant(name)])
886
851
 
887
852
  if obj_type in project_objects:
888
853
  database_name = parts[0] if len(parts) > 1 else database_name
889
- where = BinaryOperation(op='and', args=[
890
- where,
891
- BinaryOperation(op='=', args=[Identifier('project'), Constant(database_name)])
892
- ])
854
+ where = BinaryOperation(
855
+ op="and", args=[where, BinaryOperation(op="=", args=[Identifier("project"), Constant(database_name)])]
856
+ )
893
857
 
894
858
  select_statement = Select(
895
859
  targets=[Star()],
896
- from_table=Identifier(
897
- parts=["information_schema", obj_type]
898
- ),
899
-
860
+ from_table=Identifier(parts=["information_schema", obj_type]),
900
861
  where=where,
901
862
  )
902
863
  query = SQLQuery(select_statement, session=self.session)
@@ -917,7 +878,9 @@ class ExecuteCommands:
917
878
  # model.?attrs
918
879
  parts = value[:1]
919
880
  attrs = value[1:]
920
- model_info = self._get_model_info(Identifier(parts=parts), except_absent=False, database_name=database_name)
881
+ model_info = self._get_model_info(
882
+ Identifier(parts=parts), except_absent=False, database_name=database_name
883
+ )
921
884
 
922
885
  if model_info is None:
923
886
  raise ExecutorException(f"Model not found: {obj_name}")
@@ -932,12 +895,16 @@ class ExecuteCommands:
932
895
  model_info["project_name"],
933
896
  model_info["model_record"].name,
934
897
  attribute=attrs,
935
- version=model_info['model_record'].version
898
+ version=model_info["model_record"].version,
936
899
  )
937
900
 
938
- return ExecuteAnswer(
939
- data=ResultSet().from_df(df, table_name="")
940
- )
901
+ return ExecuteAnswer(data=ResultSet.from_df(df, table_name=""))
902
+
903
+ def answer_create_kb_index(self, statement, database_name):
904
+ table_name = statement.name.parts[-1]
905
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
906
+ self.session.kb_controller.create_index(table_name=table_name, project_name=project_name)
907
+ return ExecuteAnswer()
941
908
 
942
909
  def _get_model_info(self, identifier, except_absent=True, database_name=None):
943
910
  if len(identifier.parts) == 1:
@@ -968,14 +935,16 @@ class ExecuteCommands:
968
935
  """Checks if there is already a predictor retraining or fine-tuning
969
936
  Do not allow to run retrain if there is another model in training process in less that 1h
970
937
  """
938
+ if ctx.company_id is None:
939
+ # bypass for tests
940
+ return
971
941
  is_cloud = self.session.config.get("cloud", False)
972
942
  if is_cloud and ctx.user_class == 0:
973
943
  models = get_model_records(active=None)
974
944
  shortest_training = None
975
945
  for model in models:
976
946
  if (
977
- model.status
978
- in (PREDICTOR_STATUS.GENERATING, PREDICTOR_STATUS.TRAINING)
947
+ model.status in (PREDICTOR_STATUS.GENERATING, PREDICTOR_STATUS.TRAINING)
979
948
  and model.training_start_at is not None
980
949
  and model.training_stop_at is None
981
950
  ):
@@ -983,10 +952,7 @@ class ExecuteCommands:
983
952
  if shortest_training is None or training_time < shortest_training:
984
953
  shortest_training = training_time
985
954
 
986
- if (
987
- shortest_training is not None
988
- and shortest_training < datetime.timedelta(hours=1)
989
- ):
955
+ if shortest_training is not None and shortest_training < datetime.timedelta(hours=1):
990
956
  raise ExecutorException(
991
957
  f"Can't start {phase_name} process while any other predictor is in status 'training' or 'generating'"
992
958
  )
@@ -997,13 +963,9 @@ class ExecuteCommands:
997
963
  if statement.query_str is None:
998
964
  if model_record.data_integration_ref is not None:
999
965
  if model_record.data_integration_ref["type"] == "integration":
1000
- integration = self.session.integration_controller.get_by_id(
1001
- model_record.data_integration_ref["id"]
1002
- )
966
+ integration = self.session.integration_controller.get_by_id(model_record.data_integration_ref["id"])
1003
967
  if integration is None:
1004
- raise EntityNotExistsError(
1005
- "The database from which the model was trained no longer exists"
1006
- )
968
+ raise EntityNotExistsError("The database from which the model was trained no longer exists")
1007
969
  elif statement.integration_name is None:
1008
970
  # set to current project
1009
971
  statement.integration_name = Identifier(database_name)
@@ -1015,25 +977,19 @@ class ExecuteCommands:
1015
977
 
1016
978
  if "engine" in statement.using:
1017
979
  ml_integration_name = statement.using.pop("engine")
1018
- ml_handler = self.session.integration_controller.get_ml_handler(
1019
- ml_integration_name
1020
- )
980
+ ml_handler = self.session.integration_controller.get_ml_handler(ml_integration_name)
1021
981
 
1022
982
  # use current ml handler
1023
983
  if ml_handler is None:
1024
984
  integration_record = get_predictor_integration(model_record)
1025
985
  if integration_record is None:
1026
986
  raise EntityNotExistsError("ML engine model was trained with does not esxists")
1027
- ml_handler = self.session.integration_controller.get_ml_handler(
1028
- integration_record.name
1029
- )
987
+ ml_handler = self.session.integration_controller.get_ml_handler(integration_record.name)
1030
988
 
1031
989
  self._sync_predictor_check(phase_name="retrain")
1032
990
  df = self.session.model_controller.retrain_model(statement, ml_handler)
1033
991
 
1034
- return ExecuteAnswer(
1035
- data=ResultSet().from_df(df)
1036
- )
992
+ return ExecuteAnswer(data=ResultSet.from_df(df))
1037
993
 
1038
994
  @profiler.profile()
1039
995
  @mark_process("learn")
@@ -1051,19 +1007,13 @@ class ExecuteCommands:
1051
1007
  # use current ml handler
1052
1008
  integration_record = get_predictor_integration(model_record)
1053
1009
  if integration_record is None:
1054
- raise Exception(
1055
- "The ML engine that the model was trained with does not exist."
1056
- )
1057
- ml_handler = self.session.integration_controller.get_ml_handler(
1058
- integration_record.name
1059
- )
1010
+ raise Exception("The ML engine that the model was trained with does not exist.")
1011
+ ml_handler = self.session.integration_controller.get_ml_handler(integration_record.name)
1060
1012
 
1061
1013
  self._sync_predictor_check(phase_name="finetune")
1062
1014
  df = self.session.model_controller.finetune_model(statement, ml_handler)
1063
1015
 
1064
- return ExecuteAnswer(
1065
- data=ResultSet().from_df(df)
1066
- )
1016
+ return ExecuteAnswer(data=ResultSet.from_df(df))
1067
1017
 
1068
1018
  def _create_integration(self, name: str, engine: str, connection_args: dict):
1069
1019
  # we have connection checkers not for any db. So do nothing if fail
@@ -1080,7 +1030,9 @@ class ExecuteCommands:
1080
1030
  raise ExecutorException(f"There is no engine '{engine}'")
1081
1031
 
1082
1032
  if handler_meta.get("import", {}).get("success") is not True:
1083
- raise ExecutorException(f"The '{engine}' handler isn't installed.\n" + get_handler_install_message(engine))
1033
+ raise ExecutorException(
1034
+ f"The '{engine}' handler isn't installed.\n" + get_handler_install_message(engine)
1035
+ )
1084
1036
 
1085
1037
  accept_connection_args = handler_meta.get("connection_args")
1086
1038
  if accept_connection_args is not None and connection_args is not None:
@@ -1098,25 +1050,17 @@ class ExecuteCommands:
1098
1050
  if isinstance(arg_value, (str, dict)) is False:
1099
1051
  raise ExecutorException(f"Unknown type of arg: '{arg_value}'")
1100
1052
  if isinstance(arg_value, str) or "path" in arg_value:
1101
- path = (
1102
- arg_value
1103
- if isinstance(arg_value, str)
1104
- else arg_value["path"]
1105
- )
1053
+ path = arg_value if isinstance(arg_value, str) else arg_value["path"]
1106
1054
  if Path(path).is_file() is False:
1107
1055
  raise ExecutorException(f"File not found at: '{path}'")
1108
1056
  elif "url" in arg_value:
1109
1057
  path = download_file(arg_value["url"])
1110
1058
  else:
1111
- raise ExecutorException(
1112
- f"Argument '{arg_name}' must be path or url to the file"
1113
- )
1059
+ raise ExecutorException(f"Argument '{arg_name}' must be path or url to the file")
1114
1060
  connection_args[arg_name] = path
1115
1061
 
1116
1062
  handler = self.session.integration_controller.create_tmp_handler(
1117
- name=name,
1118
- engine=engine,
1119
- connection_args=connection_args
1063
+ name=name, engine=engine, connection_args=connection_args
1120
1064
  )
1121
1065
  status = handler.check_connection()
1122
1066
  if status.copy_storage:
@@ -1129,13 +1073,13 @@ class ExecuteCommands:
1129
1073
 
1130
1074
  integration = self.session.integration_controller.get(name)
1131
1075
  if integration is not None:
1132
- raise EntityExistsError('Database already exists', name)
1076
+ raise EntityExistsError("Database already exists", name)
1133
1077
  try:
1134
1078
  integration = ProjectController().get(name=name)
1135
1079
  except EntityNotExistsError:
1136
1080
  pass
1137
1081
  if integration is not None:
1138
- raise EntityExistsError('Project exists with this name', name)
1082
+ raise EntityExistsError("Project exists with this name", name)
1139
1083
 
1140
1084
  self.session.integration_controller.add(name, engine, connection_args)
1141
1085
  if storage:
@@ -1143,11 +1087,10 @@ class ExecuteCommands:
1143
1087
  handler.handler_storage.import_files(storage)
1144
1088
 
1145
1089
  def answer_create_ml_engine(self, name: str, handler: str, params: dict = None, if_not_exists=False):
1146
-
1147
1090
  integrations = self.session.integration_controller.get_all()
1148
1091
  if name in integrations:
1149
1092
  if not if_not_exists:
1150
- raise EntityExistsError('Integration already exists', name)
1093
+ raise EntityExistsError("Integration already exists", name)
1151
1094
  else:
1152
1095
  return ExecuteAnswer()
1153
1096
 
@@ -1165,21 +1108,19 @@ class ExecuteCommands:
1165
1108
  params_out[key] = value
1166
1109
 
1167
1110
  try:
1168
- self.session.integration_controller.add(
1169
- name=name, engine=handler, connection_args=params_out
1170
- )
1111
+ self.session.integration_controller.add(name=name, engine=handler, connection_args=params_out)
1171
1112
  except Exception as e:
1172
1113
  msg = str(e)
1173
1114
  if type(e) in (ImportError, ModuleNotFoundError):
1174
1115
  msg = dedent(
1175
1116
  f"""\
1176
- The '{handler_module_meta['name']}' handler cannot be used. Reason is:
1177
- {handler_module_meta['import']['error_message']}
1117
+ The '{handler_module_meta["name"]}' handler cannot be used. Reason is:
1118
+ {handler_module_meta["import"]["error_message"]}
1178
1119
  """
1179
1120
  )
1180
1121
  is_cloud = self.session.config.get("cloud", False)
1181
- if is_cloud is False and "No module named" in handler_module_meta['import']['error_message']:
1182
- logger.info(get_handler_install_message(handler_module_meta['name']))
1122
+ if is_cloud is False and "No module named" in handler_module_meta["import"]["error_message"]:
1123
+ logger.info(get_handler_install_message(handler_module_meta["name"]))
1183
1124
  ast_drop = DropMLEngine(name=Identifier(name))
1184
1125
  self.answer_drop_ml_engine(ast_drop)
1185
1126
  logger.info(msg)
@@ -1192,7 +1133,7 @@ class ExecuteCommands:
1192
1133
  integrations = self.session.integration_controller.get_all()
1193
1134
  if name not in integrations:
1194
1135
  if not statement.if_exists:
1195
- raise EntityNotExistsError('Integration does not exists', name)
1136
+ raise EntityNotExistsError("Integration does not exists", name)
1196
1137
  else:
1197
1138
  return ExecuteAnswer()
1198
1139
  self.session.integration_controller.delete(name)
@@ -1261,25 +1202,15 @@ class ExecuteCommands:
1261
1202
  # TODO do we need feature: delete object from project via drop table?
1262
1203
 
1263
1204
  project = self.session.database_controller.get_project(db_name)
1264
- project_tables = {
1265
- key: val
1266
- for key, val in project.get_tables().items()
1267
- if val.get("deletable") is True
1268
- }
1205
+ project_tables = {key: val for key, val in project.get_tables().items() if val.get("deletable") is True}
1269
1206
  table_name = table.to_string()
1270
1207
 
1271
1208
  if table_name in project_tables:
1272
- self.session.model_controller.delete_model(
1273
- table_name, project_name=db_name
1274
- )
1209
+ self.session.model_controller.delete_model(table_name, project_name=db_name)
1275
1210
  elif statement.if_exists is False:
1276
- raise ExecutorException(
1277
- f"Cannot delete a table from database '{db_name}': table does not exists"
1278
- )
1211
+ raise ExecutorException(f"Cannot delete a table from database '{db_name}': table does not exists")
1279
1212
  else:
1280
- raise ExecutorException(
1281
- f"Cannot delete a table from database '{db_name}'"
1282
- )
1213
+ raise ExecutorException(f"Cannot delete a table from database '{db_name}'")
1283
1214
 
1284
1215
  return ExecuteAnswer()
1285
1216
 
@@ -1300,9 +1231,7 @@ class ExecuteCommands:
1300
1231
  if isinstance(statement.from_table, Identifier):
1301
1232
  query = Select(
1302
1233
  targets=[Star()],
1303
- from_table=NativeQuery(
1304
- integration=statement.from_table, query=statement.query_str
1305
- ),
1234
+ from_table=NativeQuery(integration=statement.from_table, query=statement.query_str),
1306
1235
  )
1307
1236
  query_str = str(query)
1308
1237
  else:
@@ -1312,15 +1241,11 @@ class ExecuteCommands:
1312
1241
  # check create view sql
1313
1242
  query.limit = Constant(1)
1314
1243
 
1315
- query_context_controller.set_context(
1316
- query_context_controller.IGNORE_CONTEXT
1317
- )
1244
+ query_context_controller.set_context(query_context_controller.IGNORE_CONTEXT)
1318
1245
  try:
1319
1246
  SQLQuery(query, session=self.session, database=database_name)
1320
1247
  finally:
1321
- query_context_controller.release_context(
1322
- query_context_controller.IGNORE_CONTEXT
1323
- )
1248
+ query_context_controller.release_context(query_context_controller.IGNORE_CONTEXT)
1324
1249
 
1325
1250
  project = self.session.database_controller.get_project(project_name)
1326
1251
  try:
@@ -1350,24 +1275,23 @@ class ExecuteCommands:
1350
1275
  return ExecuteAnswer()
1351
1276
 
1352
1277
  def answer_create_kb(self, statement: CreateKnowledgeBase, database_name: str):
1353
- project_name = (
1354
- statement.name.parts[0]
1355
- if len(statement.name.parts) > 1
1356
- else database_name
1357
- )
1278
+ if statement.model:
1279
+ raise ExecutorException(
1280
+ "Creating a knowledge base using pre-existing models is no longer supported.\n"
1281
+ "Please pass the model parameters as a JSON object in the embedding_model field."
1282
+ )
1283
+
1284
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1358
1285
 
1359
1286
  if statement.storage is not None:
1360
1287
  if len(statement.storage.parts) != 2:
1361
1288
  raise ExecutorException(
1362
- f"Invalid vectordatabase table name: {statement.storage}"
1363
- "Need the form 'database_name.table_name'"
1289
+ f"Invalid vectordatabase table name: {statement.storage}Need the form 'database_name.table_name'"
1364
1290
  )
1365
1291
 
1366
1292
  if statement.from_query is not None:
1367
1293
  # TODO: implement this
1368
- raise ExecutorException(
1369
- "Create a knowledge base from a select is not supported yet"
1370
- )
1294
+ raise ExecutorException("Create a knowledge base from a select is not supported yet")
1371
1295
 
1372
1296
  kb_name = statement.name.parts[-1]
1373
1297
 
@@ -1375,7 +1299,7 @@ class ExecuteCommands:
1375
1299
  _ = self.session.kb_controller.add(
1376
1300
  name=kb_name,
1377
1301
  project_name=project_name,
1378
- embedding_model=statement.model,
1302
+ # embedding_model=statement.model,
1379
1303
  storage=statement.storage,
1380
1304
  params=statement.params,
1381
1305
  if_not_exists=statement.if_not_exists,
@@ -1385,11 +1309,7 @@ class ExecuteCommands:
1385
1309
 
1386
1310
  def answer_drop_kb(self, statement: DropKnowledgeBase, database_name: str):
1387
1311
  name = statement.name.parts[-1]
1388
- project_name = (
1389
- statement.name.parts[0]
1390
- if len(statement.name.parts) > 1
1391
- else database_name
1392
- )
1312
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1393
1313
 
1394
1314
  # delete the knowledge base
1395
1315
  self.session.kb_controller.delete(
@@ -1402,19 +1322,10 @@ class ExecuteCommands:
1402
1322
 
1403
1323
  def answer_create_skill(self, statement, database_name):
1404
1324
  name = statement.name.parts[-1]
1405
- project_name = (
1406
- statement.name.parts[0]
1407
- if len(statement.name.parts) > 1
1408
- else database_name
1409
- )
1325
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1410
1326
 
1411
1327
  try:
1412
- _ = self.session.skills_controller.add_skill(
1413
- name,
1414
- project_name,
1415
- statement.type,
1416
- statement.params
1417
- )
1328
+ _ = self.session.skills_controller.add_skill(name, project_name, statement.type, statement.params)
1418
1329
  except ValueError as e:
1419
1330
  # Project does not exist or skill already exists.
1420
1331
  raise ExecutorException(str(e))
@@ -1423,11 +1334,7 @@ class ExecuteCommands:
1423
1334
 
1424
1335
  def answer_drop_skill(self, statement, database_name):
1425
1336
  name = statement.name.parts[-1]
1426
- project_name = (
1427
- statement.name.parts[0]
1428
- if len(statement.name.parts) > 1
1429
- else database_name
1430
- )
1337
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1431
1338
 
1432
1339
  try:
1433
1340
  self.session.skills_controller.delete_skill(name, project_name)
@@ -1439,19 +1346,12 @@ class ExecuteCommands:
1439
1346
 
1440
1347
  def answer_update_skill(self, statement, database_name):
1441
1348
  name = statement.name.parts[-1]
1442
- project_name = (
1443
- statement.name.parts[0]
1444
- if len(statement.name.parts) > 1
1445
- else database_name
1446
- )
1349
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1447
1350
 
1448
- type = statement.params.pop('type', None)
1351
+ type = statement.params.pop("type", None)
1449
1352
  try:
1450
1353
  _ = self.session.skills_controller.update_skill(
1451
- name,
1452
- project_name=project_name,
1453
- type=type,
1454
- params=statement.params
1354
+ name, project_name=project_name, type=type, params=statement.params
1455
1355
  )
1456
1356
  except ValueError as e:
1457
1357
  # Project does not exist or skill does not exist.
@@ -1461,14 +1361,10 @@ class ExecuteCommands:
1461
1361
 
1462
1362
  def answer_create_agent(self, statement, database_name):
1463
1363
  name = statement.name.parts[-1]
1464
- project_name = (
1465
- statement.name.parts[0]
1466
- if len(statement.name.parts) > 1
1467
- else database_name
1468
- )
1364
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1469
1365
 
1470
- skills = statement.params.pop('skills', [])
1471
- provider = statement.params.pop('provider', None)
1366
+ skills = statement.params.pop("skills", [])
1367
+ provider = statement.params.pop("provider", None)
1472
1368
  try:
1473
1369
  _ = self.session.agents_controller.add_agent(
1474
1370
  name=name,
@@ -1476,7 +1372,7 @@ class ExecuteCommands:
1476
1372
  model_name=statement.model,
1477
1373
  skills=skills,
1478
1374
  provider=provider,
1479
- params=statement.params
1375
+ params=statement.params,
1480
1376
  )
1481
1377
  except ValueError as e:
1482
1378
  # Project does not exist or agent already exists.
@@ -1486,11 +1382,7 @@ class ExecuteCommands:
1486
1382
 
1487
1383
  def answer_drop_agent(self, statement, database_name):
1488
1384
  name = statement.name.parts[-1]
1489
- project_name = (
1490
- statement.name.parts[0]
1491
- if len(statement.name.parts) > 1
1492
- else database_name
1493
- )
1385
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1494
1386
 
1495
1387
  try:
1496
1388
  self.session.agents_controller.delete_agent(name, project_name)
@@ -1502,15 +1394,11 @@ class ExecuteCommands:
1502
1394
 
1503
1395
  def answer_update_agent(self, statement, database_name):
1504
1396
  name = statement.name.parts[-1]
1505
- project_name = (
1506
- statement.name.parts[0]
1507
- if len(statement.name.parts) > 1
1508
- else database_name
1509
- )
1397
+ project_name = statement.name.parts[0] if len(statement.name.parts) > 1 else database_name
1510
1398
 
1511
- model = statement.params.pop('model', None)
1512
- skills_to_add = statement.params.pop('skills_to_add', [])
1513
- skills_to_remove = statement.params.pop('skills_to_remove', [])
1399
+ model = statement.params.pop("model", None)
1400
+ skills_to_add = statement.params.pop("skills_to_add", [])
1401
+ skills_to_remove = statement.params.pop("skills_to_remove", [])
1514
1402
  try:
1515
1403
  _ = self.session.agents_controller.update_agent(
1516
1404
  name,
@@ -1518,7 +1406,7 @@ class ExecuteCommands:
1518
1406
  model_name=model,
1519
1407
  skills_to_add=skills_to_add,
1520
1408
  skills_to_remove=skills_to_remove,
1521
- params=statement.params
1409
+ params=statement.params,
1522
1410
  )
1523
1411
  except (EntityExistsError, EntityNotExistsError, ValueError) as e:
1524
1412
  # Project does not exist or agent does not exist.
@@ -1548,31 +1436,24 @@ class ExecuteCommands:
1548
1436
  statement.integration_name = Identifier(database_name)
1549
1437
 
1550
1438
  try:
1551
- ml_handler = self.session.integration_controller.get_ml_handler(
1552
- ml_integration_name
1553
- )
1439
+ ml_handler = self.session.integration_controller.get_ml_handler(ml_integration_name)
1554
1440
  except EntityNotExistsError:
1555
1441
  # not exist, try to create it with same name as handler
1556
1442
  self.answer_create_ml_engine(ml_integration_name, handler=ml_integration_name)
1557
1443
 
1558
- ml_handler = self.session.integration_controller.get_ml_handler(
1559
- ml_integration_name
1560
- )
1444
+ ml_handler = self.session.integration_controller.get_ml_handler(ml_integration_name)
1561
1445
 
1562
1446
  if getattr(statement, "is_replace", False) is True:
1563
1447
  # try to delete
1564
1448
  try:
1565
- self.session.model_controller.delete_model(
1566
- model_name,
1567
- project_name=integration_name
1568
- )
1449
+ self.session.model_controller.delete_model(model_name, project_name=integration_name)
1569
1450
  except EntityNotExistsError:
1570
1451
  pass
1571
1452
 
1572
1453
  try:
1573
1454
  df = self.session.model_controller.create_model(statement, ml_handler)
1574
1455
 
1575
- return ExecuteAnswer(data=ResultSet().from_df(df))
1456
+ return ExecuteAnswer(data=ResultSet.from_df(df))
1576
1457
  except EntityExistsError:
1577
1458
  if getattr(statement, "if_not_exists", False) is True:
1578
1459
  return ExecuteAnswer()
@@ -1598,9 +1479,7 @@ class ExecuteCommands:
1598
1479
  "and",
1599
1480
  args=[
1600
1481
  BinaryOperation("=", args=[Identifier("TABLE_SCHEMA"), Constant(db)]),
1601
- BinaryOperation(
1602
- "=", args=[Identifier("TABLE_NAME"), Constant(table_name)]
1603
- ),
1482
+ BinaryOperation("=", args=[Identifier("TABLE_NAME"), Constant(table_name)]),
1604
1483
  ],
1605
1484
  )
1606
1485
  if where is not None:
@@ -1637,9 +1516,7 @@ class ExecuteCommands:
1637
1516
  def answer_show_create_table(self, table):
1638
1517
  columns = [
1639
1518
  Column(table_name="", name="Table", type=TYPES.MYSQL_TYPE_VAR_STRING),
1640
- Column(
1641
- table_name="", name="Create Table", type=TYPES.MYSQL_TYPE_VAR_STRING
1642
- ),
1519
+ Column(table_name="", name="Create Table", type=TYPES.MYSQL_TYPE_VAR_STRING),
1643
1520
  ]
1644
1521
  return ExecuteAnswer(
1645
1522
  data=ResultSet(
@@ -1967,14 +1844,14 @@ class ExecuteCommands:
1967
1844
 
1968
1845
  def answer_update_model_version(self, model_version, database_name):
1969
1846
  if not isinstance(model_version, Identifier):
1970
- raise ExecutorException(f'Please define version: {model_version}')
1847
+ raise ExecutorException(f"Please define version: {model_version}")
1971
1848
 
1972
1849
  model_parts = model_version.parts
1973
1850
  version = model_parts[-1]
1974
1851
  if version.isdigit():
1975
1852
  version = int(version)
1976
1853
  else:
1977
- raise ExecutorException(f'Unknown version: {version}')
1854
+ raise ExecutorException(f"Unknown version: {version}")
1978
1855
 
1979
1856
  if len(model_parts) == 3:
1980
1857
  project_name, model_name = model_parts[:2]
@@ -1982,13 +1859,12 @@ class ExecuteCommands:
1982
1859
  model_name = model_parts[0]
1983
1860
  project_name = database_name
1984
1861
  else:
1985
- raise ExecutorException(f'Unknown model: {model_version}')
1862
+ raise ExecutorException(f"Unknown model: {model_version}")
1986
1863
 
1987
1864
  self.session.model_controller.set_model_active_version(project_name, model_name, version)
1988
1865
  return ExecuteAnswer()
1989
1866
 
1990
1867
  def answer_drop_model(self, statement, database_name):
1991
-
1992
1868
  model_parts = statement.name.parts
1993
1869
  version = None
1994
1870
 
@@ -2003,7 +1879,7 @@ class ExecuteCommands:
2003
1879
  model_name = model_parts[0]
2004
1880
  project_name = database_name
2005
1881
  else:
2006
- raise ExecutorException(f'Unknown model: {statement.name}')
1882
+ raise ExecutorException(f"Unknown model: {statement.name}")
2007
1883
 
2008
1884
  if version is not None:
2009
1885
  # delete version