Skip to main content
Glama
samhavens

Databricks MCP Server

by samhavens

get_sql_status

Check the execution status and retrieve results for SQL queries in Databricks using statement IDs.

Instructions

Get the status and results of a SQL statement by statement_id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
statement_idYes

Implementation Reference

  • MCP tool handler and registration for 'get_sql_status'. Takes statement_id as input, fetches status via 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)})
  • Supporting utility function that performs the actual API call to Databricks /sql/statements/{statement_id} endpoint to retrieve the SQL 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={})

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samhavens/databricks-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server