show_files
View underlying data files of Iceberg tables by specifying catalog, schema, and table names to analyze storage structure and file organization.
Instructions
Show Iceberg table data files
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| catalog | Yes | catalog name | |
| schema_name | Yes | schema name | |
| table | Yes | The name of the table |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/server.py:404-436 (handler)MCP tool handler for 'show_files'. Decorated with @mcp.tool(), validates inputs using pydantic Field schemas, and delegates to client.show_files().
@mcp.tool(description="Show Iceberg table data files") def show_files( catalog: str = Field(description="catalog name "), schema_name: str = Field(description="schema name "), table: str = Field(description="The name of the table"), ) -> str: """Show Iceberg table data files in current snapshot. The files table contains: - content: Type of content (0=DATA, 1=POSITION_DELETES, 2=EQUALITY_DELETES) - file_path: Data file location - file_format: Format of the data file - record_count: Number of records in file - file_size_in_bytes: File size - column_sizes: Column ID to size mapping - value_counts: Column ID to value count mapping - null_value_counts: Column ID to null count mapping - nan_value_counts: Column ID to NaN count mapping - lower_bounds: Column ID to lower bound mapping - upper_bounds: Column ID to upper bound mapping - key_metadata: Encryption key metadata - split_offsets: Recommended split locations - equality_ids: Field IDs for equality deletes Args: catalog: catalog name schema_name: schema name table: The name of the table Returns: str: JSON-formatted table files info """ return client.show_files(catalog, schema_name, table) - src/trino_client.py:508-541 (helper)Core implementation of show_files in TrinoClient class. Constructs SQL query to query the Iceberg $files metadata table and returns JSON-formatted results.
def show_files(self, table: str, catalog: str, schema: str) -> str: """Show Iceberg table data files in current snapshot. The files table contains: - content: INTEGER - Type of content (0=DATA, 1=POSITION_DELETES, 2=EQUALITY_DELETES) - file_path: VARCHAR - Data file location - file_format: VARCHAR - Format of the data file - record_count: BIGINT - Number of records in file - file_size_in_bytes: BIGINT - File size - column_sizes: map(INTEGER, BIGINT) - Column ID to size mapping - value_counts: map(INTEGER, BIGINT) - Column ID to value count mapping - null_value_counts: map(INTEGER, BIGINT) - Column ID to null count mapping - nan_value_counts: map(INTEGER, BIGINT) - Column ID to NaN count mapping - lower_bounds: map(INTEGER, VARCHAR) - Column ID to lower bound mapping - upper_bounds: map(INTEGER, VARCHAR) - Column ID to upper bound mapping - key_metadata: VARBINARY - Encryption key metadata - split_offsets: array(BIGINT) - Recommended split locations - equality_ids: array(INTEGER) - Field IDs for equality deletes Args: table: The name of the table catalog: Optional catalog name (defaults to configured catalog) schema: Optional schema name (defaults to configured schema) Returns: str: JSON-formatted string containing table files info """ catalog = catalog or self.config.catalog schema = schema or self.config.schema if not catalog or not schema: raise CatalogSchemaError table_identifier = f"{catalog}.{schema}.{table}$files" query = 'SELECT * FROM "{}"' return self.execute_query(query.format(table_identifier))