Yeoman generator that scaffolds Superset visualization plugins and packages with proper structure and boilerplate code
63
Build a Python utility that executes SQL queries using Apache Superset's SQL Lab functionality, with support for query history tracking.
@generates
from typing import List, Dict, Any, Optional
from datetime import datetime
class SQLExecutor:
"""
A utility class for executing SQL queries using Apache Superset's SQL Lab.
"""
def __init__(self, database_id: int):
"""
Initialize the SQL executor with a database connection.
Args:
database_id: The ID of the Superset database to query against
"""
pass
def execute_query(self, sql: str) -> List[Dict[str, Any]]:
"""
Execute a SQL query and return results.
Args:
sql: The SQL query string to execute
Returns:
A list of dictionaries, where each dictionary represents a row
with column names as keys
Raises:
ValueError: If the SQL query is empty or invalid
"""
pass
def get_query_history(self) -> List[Dict[str, Any]]:
"""
Retrieve the history of executed queries.
Returns:
A list of dictionaries containing query metadata, including:
- 'sql': The query text
- 'executed_at': Timestamp of execution
"""
pass
def get_latest_query(self) -> Optional[Dict[str, Any]]:
"""
Get the most recently executed query from history.
Returns:
A dictionary with query metadata, or None if no queries have been executed
"""
passProvides SQL Lab functionality for executing SQL queries programmatically, including query execution, result handling, and query history tracking.
Install with Tessl CLI
npx tessl i tessl/npm-superset-ui--generator-supersetdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10