qlty_missingValues
Identify columns with missing values in a specified Teradata database table. Input database and table names to receive a formatted response with query results and metadata.
Instructions
Get the column names that having missing values in a table.
Arguments: database_name - name of the database table_name - table name to analyze
Returns: ResponseType: formatted response with query results + metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_name | Yes | ||
| table_name | Yes |
Implementation Reference
- The main handler function for the 'qlty_missingValues' tool. It connects to Teradata, executes a query using TD_ColumnSummary to identify columns with missing values (NullCount and NullPercentage), processes the results into JSON, adds metadata, and returns a formatted response.def handle_qlty_missingValues(conn: TeradataConnection, database_name: str | None, table_name: str, *args, **kwargs): """ Get the column names that having missing values in a table. Arguments: database_name - name of the database table_name - table name to analyze Returns: ResponseType: formatted response with query results + metadata """ logger.debug(f"Tool: handle_qlty_missingValues: Args: table_name: {database_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"select ColumnName, NullCount, NullPercentage from TD_ColumnSummary ( on {table_name} as InputTable using TargetColumns ('[:]')) as dt ORDER BY NullCount desc") data = rows_to_json(cur.description, rows.fetchall()) metadata = { "tool_name": "qlty_missingValues", "database_name": database_name, "table_name": table_name, "rows": len(data) } logger.debug(f"Tool: handle_qlty_missingValues: Metadata: {metadata}") return create_response(data, metadata)