query_database
Execute SQL queries on a specified database server, format results as Markdown, JSON Lines, or CSV, and manage query timeouts and row limits for efficient data retrieval.
Instructions
Execute a SQL query against a specified database server and return formatted results. Maybe slow for complex queries.
Args:
database_server (str): The name of the database server to query (must be registered)
sql_query (str): The SQL query to execute (will be wrapped in a SELECT statement)
query_timeout_seconds (int, optional): Maximum time in seconds to wait for query execution.
Defaults to DEFAULT_QUERY_TIMEOUT_SECONDS.
data_format (str, optional): Output format for results. Options:
"md" - Markdown table format
"jsonl" - JSON Lines format (one JSON object per row)
"csv" - Comma-separated values with header row
Defaults to DEFAULT_DATA_FORMAT.
rows_limit (int, optional): Maximum number of rows to return. Defaults to DEFAULT_ROWS_LIMIT.
Returns:
str: Query results as a string in the specified format
Input Schema
Name | Required | Description | Default |
---|---|---|---|
data_format | No | csv | |
database_server | Yes | ||
query_timeout_seconds | No | ||
rows_limit | No | ||
sql_query | Yes |
Input Schema (JSON Schema)
{
"properties": {
"data_format": {
"default": "csv",
"enum": [
"md",
"jsonl",
"csv"
],
"title": "Data Format",
"type": "string"
},
"database_server": {
"title": "Database Server",
"type": "string"
},
"query_timeout_seconds": {
"default": 10,
"title": "Query Timeout Seconds",
"type": "integer"
},
"rows_limit": {
"default": 100,
"title": "Rows Limit",
"type": "integer"
},
"sql_query": {
"title": "Sql Query",
"type": "string"
}
},
"required": [
"database_server",
"sql_query"
],
"title": "query_databaseArguments",
"type": "object"
}