agentscope.service.sql_query.mysql module

query in Mysql

agentscope.service.sql_query.mysql.query_mysql(database: str, query: str, host: str, user: str, password: str, port: int, allow_change_data: bool = False, maxcount_results: int | None = None, **kwargs: Any) ServiceResponse[源代码]

Execute query within MySQL database.

参数:
  • database (str) – The name of the database to use.

  • query (str) – SQL query to execute.

  • host (str) – The host name or IP address of the MySQL server, e.g. “localhost”.

  • user (str) – The username of the MySQL account to use.

  • password (str) – The password of the MySQL account to use.

  • port (str) – The port number of the MySQL server, e.g. 3306.

  • allow_change_data (bool, defaults to False) – Whether to allow changing data in the database. Defaults to False to avoid accidental changes to the database.

  • maxcount_results (int, defaults to None) – The maximum number of results to return. Defaults to 100 to avoid too many results.

返回:

A ServiceResponse object that contains execution results or error message.

返回类型:

ServiceResponse