get_sql_status
Retrieve the status and results of a Databricks SQL statement using its statement_id for monitoring and analysis.
Instructions
Get the status and results of a SQL statement by statement_id
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| statement_id | Yes |
Implementation Reference
- MCP tool handler for get_sql_status: logs the request, calls the sql.get_statement_status helper, returns JSON result or error.@mcp.tool() async def get_sql_status(statement_id: str) -> str: """Get the status and results of a SQL statement by statement_id""" logger.info(f"Getting status for SQL statement: {statement_id}") try: result = await sql.get_statement_status(statement_id) return json.dumps(result) except Exception as e: logger.error(f"Error getting SQL status: {str(e)}") return json.dumps({"error": str(e)})
- src/api/sql.py:140-154 (helper)Helper function implementing the Databricks SQL Statements API call to retrieve statement status.async def get_statement_status(statement_id: str) -> Dict[str, Any]: """ Get the status of a SQL statement. Args: statement_id: ID of the statement to check Returns: Response containing statement status Raises: DatabricksAPIError: If the API request fails """ logger.info(f"Getting status of SQL statement: {statement_id}") return make_api_request("GET", f"/api/2.0/sql/statements/{statement_id}", params={})