Skip to main content
Glama
blitzstermayank

Teradata MCP Server

base_tableDDL

Retrieve the Data Definition Language (DDL) for a Teradata table to view its structure and schema definition. This tool displays the complete SQL statement used to create or alter the table.

Instructions

Displays the DDL definition of a table via SQLAlchemy, bind parameters if provided (prepared SQL), and return the fully rendered SQL (with literals) in metadata.

Arguments: database_name - Database name table_name - table name

Returns: ResponseType: formatted response with query results + metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameYes
table_nameYes

Implementation Reference

  • Handler function that implements the base_tableDDL tool by executing 'SHOW TABLE' command on the Teradata connection and formatting the results with metadata.
    def handle_base_tableDDL(conn: TeradataConnection, database_name: str | None, table_name: str, *args, **kwargs):
        """
        Displays the DDL definition of a table via SQLAlchemy, bind parameters if provided (prepared SQL), and return the fully rendered SQL (with literals) in metadata.
    
        Arguments:
          database_name - Database name
          table_name - table name
    
        Returns:
          ResponseType: formatted response with query results + metadata
        """
        logger.debug(f"Tool: handle_base_tableDDL: Args: database_name: {database_name}, table_name: {table_name}")
    
        if database_name is not None:
            table_name = f"{database_name}.{table_name}"
        with conn.cursor() as cur:
            rows = cur.execute(f"show table {table_name}")
            data = rows_to_json(cur.description, rows.fetchall())
            metadata = {
                "tool_name": "base_tableDDL",
                "database": database_name,
                "table": table_name,
                "rows": len(data)
            }
            logger.debug(f"Tool: handle_base_tableDDL: metadata: {metadata}")
            return create_response(data, metadata)

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/blitzstermayank/MCP'

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