base_databaseList
List all databases available in the Teradata system to identify and access database resources for querying and management operations.
Instructions
Lists all databases in the Teradata System.
Returns: ResponseType: formatted response with query results + metadata
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function that executes the tool logic: runs a fixed SQL query to list databases (name, type, comment) excluding PDCRADM-owned, processes results into JSON, builds metadata with tool_name 'base_databaseList', columns info, row count, and returns formatted response.def handle_base_databaseList(conn: TeradataConnection, *args, **kwargs): """ Lists all databases in the Teradata System. Returns: ResponseType: formatted response with query results + metadata """ logger.debug(f"Tool: handle_base_databaseList: Args: None") sql = "select DataBaseName, DECODE(DBKind, 'U', 'User', 'D','DataBase') as DBType, CommentString from dbc.DatabasesV dv where OwnerName <> 'PDCRADM'" with conn.cursor() as cur: rows = cur.execute(sql) data = rows_to_json(cur.description, rows.fetchall()) metadata = { "tool_name": "base_databaseList", "sql": sql, "columns": [ {"name": col[0], "type": col[1].__name__ if hasattr(col[1], '__name__') else str(col[1])} for col in cur.description ] if cur.description else [], "row_count": len(data) } logger.debug(f"Tool: handle_base_databaseList: metadata: {metadata}") return create_response(data, metadata)