qlty_negativeValues
Identify columns with negative values in a specified Teradata table to ensure data quality. Input database and table names to receive formatted results with query output and metadata for analysis.
Instructions
Get the column names that having negative 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 handler function for the 'qlty_negativeValues' tool. It queries the Teradata table using TD_ColumnSummary to identify columns with negative values, formats the results into JSON, adds metadata including the tool name, and returns a structured response.def handle_qlty_negativeValues(conn: TeradataConnection, database_name: str | None, table_name: str, *args, **kwargs): """ Get the column names that having negative 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_negativeValues: 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, NegativeCount from TD_ColumnSummary ( on {table_name} as InputTable using TargetColumns ('[:]')) as dt ORDER BY NegativeCount desc") data = rows_to_json(cur.description, rows.fetchall()) metadata = { "tool_name": "qlty_negativeValues", "database_name": database_name, "table_name": table_name, "rows": len(data) } logger.debug(f"Tool: handle_qlty_negativeValues: Metadata: {metadata}") return create_response(data, metadata)