show_hg_table_ddl
Retrieve the Data Definition Language (DDL) script for tables, views, or foreign tables in Hologres databases to understand their structure and recreate them.
Instructions
Show DDL script for a table, view, or foreign table in Hologres database.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | Schema name in Hologres database | |
| table | Yes | Table name in Hologres database |
Implementation Reference
- Handler implementation for the 'show_hg_table_ddl' tool within the call_tool function. It validates input arguments, constructs the SQL query using hg_dump_script to fetch the table DDL, and passes it to the general execution handler.elif name == "show_hg_table_ddl": schema = arguments.get("schema") table = arguments.get("table") if not all([schema, table]): raise ValueError("Schema and table are required") query = f"SELECT hg_dump_script('\"{schema}\".\"{table}\"')"
- src/hologres_mcp_server/server.py:527-545 (registration)Registration of the 'show_hg_table_ddl' tool in the list_tools() function, including name, description, and input schema definition.# 新增 show_hg_table_ddl 工具 Tool( name="show_hg_table_ddl", description="Show DDL script for a table, view, or foreign table in Hologres database.", inputSchema={ "type": "object", "properties": { "schema": { "type": "string", "description": "Schema name in Hologres database" }, "table": { "type": "string", "description": "Table name in Hologres database" } }, "required": ["schema", "table"] } )
- Input schema definition for the 'show_hg_table_ddl' tool, specifying required 'schema' and 'table' string parameters.inputSchema={ "type": "object", "properties": { "schema": { "type": "string", "description": "Schema name in Hologres database" }, "table": { "type": "string", "description": "Table name in Hologres database" } }, "required": ["schema", "table"] }