CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-superset-ui--generator-superset

Yeoman generator that scaffolds Superset visualization plugins and packages with proper structure and boilerplate code

63

1.21x
Overview
Eval results
Files

task.mdevals/scenario-6/

Dashboard Report Generator

Create a utility that generates a summary report for dashboards in a Superset instance. The utility should retrieve dashboard information, analyze their structure, and export the data to a JSON file.

Requirements

Dashboard Retrieval

The utility should connect to a Superset instance and retrieve a list of all dashboards. For each dashboard, it should collect:

  • Dashboard title
  • Number of charts in the dashboard
  • Dashboard owner's username
  • Dashboard creation date
  • Whether the dashboard is published

Data Export

The utility should export the collected dashboard information to a JSON file named dashboard_report.json. The JSON file should contain an array of dashboard objects with the following structure:

[
  {
    "title": "Sales Dashboard",
    "chart_count": 5,
    "owner": "admin",
    "created_on": "2024-01-15T10:30:00",
    "published": true
  }
]

Test Cases

  • When connected to a Superset instance with 2 dashboards, the report contains exactly 2 dashboard entries @test
  • When a dashboard has 3 charts, the report correctly shows chart_count as 3 @test
  • The exported JSON file is valid and can be parsed @test

Implementation

@generates

API

def get_dashboard_list(base_url: str, username: str, password: str) -> list:
    """
    Retrieves all dashboards from a Superset instance.

    Args:
        base_url: The base URL of the Superset instance (e.g., 'http://localhost:8088')
        username: Username for authentication
        password: Password for authentication

    Returns:
        A list of dictionaries containing dashboard information
    """
    pass

def export_to_json(dashboards: list, output_file: str) -> None:
    """
    Exports dashboard data to a JSON file.

    Args:
        dashboards: List of dashboard dictionaries
        output_file: Path to the output JSON file
    """
    pass

Dependencies { .dependencies }

apache-superset { .dependency }

Provides dashboard management and REST API access for programmatic operations.

Install with Tessl CLI

npx tessl i tessl/npm-superset-ui--generator-superset

tile.json