show_create_view
Retrieve the CREATE VIEW statement for a view using its catalog, schema, and name.
Instructions
Show the CREATE VIEW statement for a specific view
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog | Yes | catalog name | |
| schema_name | Yes | schema name | |
| view | Yes | The name of the view |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server.py:109-125 (handler)MCP tool handler function that decorates show_create_view with @mcp.tool and calls client.show_create_view().
@mcp.tool(description="Show the CREATE VIEW statement for a specific view") def show_create_view( catalog: str = Field(description="catalog name "), schema_name: str = Field(description="schema name "), view: str = Field(description="The name of the view"), ) -> str: """Show the CREATE VIEW statement for a view. Args: catalog: catalog name schema_name: schema name view: The name of the view Returns: str: The CREATE VIEW statement """ return client.show_create_view(catalog, schema_name, view) - src/trino_client.py:194-219 (helper)Client implementation that builds and executes the SQL 'SHOW CREATE VIEW' query and returns the result.
def show_create_view( self, catalog: str, schema: str, view: str, ) -> str: """Show the CREATE VIEW statement for a view. Args: catalog (str): The catalog name. If None, uses configured default. schema (str): The schema name. If None, uses configured default. view (str): The name of the view. Returns: str: The CREATE VIEW statement for the specified view. Raises: CatalogSchemaError: If either catalog or schema is not specified and not configured. """ catalog = catalog or self.config.catalog schema = schema or self.config.schema if not catalog or not schema: raise CatalogSchemaError query = f"SHOW CREATE VIEW {catalog}.{schema}.{view}" result = json.loads(self.execute_query(query)) return result[0]["Create View"] if result else ""