superset_sqllab_execute
Execute SQL queries via Superset's SQL Lab to retrieve data. Provide database ID and SQL; set schema, catalog, or template params as needed.
Instructions
Execute a SQL query via SQL Lab and return the result.
IMPORTANT: before executing, make sure the SQL query is correct. Use superset_database_table_metadata or superset_database_tables to find actual table and column names. Maximum 1000 rows in the result (queryLimit).
Args: database_id: Database connection ID (from superset_database_list). sql: SQL query to execute. Examples: - SELECT * FROM public.my_table LIMIT 10 - SELECT count(*) FROM source.stat schema: Default schema for the query (e.g. "public", "source"). If not specified, the database default schema is used. catalog: Database catalog (for databases with catalog support, optional). tab_name: Tab name in SQL Lab UI (optional, for organization). template_params: JSON string with Jinja template parameters (optional). Example: '{"start_date": "2024-01-01"}'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| schema | No | ||
| catalog | No | ||
| tab_name | No | ||
| database_id | Yes | ||
| template_params | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |