execute_japan_megabank_sql
Run read-only DuckDB SQL SELECT queries across 155 Japanese public datasets to aggregate, group, and join records by municipality or corporate number.
Instructions
Execute a read-only DuckDB SQL SELECT query across all 155 mounted datasets (10.16M+ records). Enables complex aggregations (COUNT, SUM, AVG, GROUP BY) and multi-table JOINs using 'municipality_code' (5-digit JIS code) or 'corporate_number' (13-digit ID). Enforces AST validation (single SELECT only, max 10,000 rows). PREREQUISITE: Requires a MEGA tier subscription on RapidAPI or local database access; always call 'describe_japan_dataset' first to confirm table and column names. WHEN NOT TO USE: Do not use for simple single-table keyword or prefecture lookups (use 'search_japan_official_data' instead, which works on all tiers including BASIC) or for browsing available tables (use 'list_japan_datasets').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Single read-only DuckDB SQL SELECT statement. DDL/DML statements are rejected. Always include a LIMIT clause (e.g., 'SELECT prefecture_en, COUNT(*) AS cnt FROM medical GROUP BY 1 ORDER BY 2 DESC LIMIT 10'). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | List of result row objects mapped by column name. | |
| columns | No | Ordered list of column names in the query result. | |
| row_count | No | Number of result rows returned by the SQL query. |