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-3/

Superset Database Testing Tool

Build a command-line utility that tests database connections for Superset deployments. The tool should validate that a database is accessible and return clear status information.

Requirements

Your tool must:

  1. Accept a database URI as a command-line argument
  2. Test the database connection and verify connectivity
  3. Display test results showing success or failure with a clear message
  4. Exit with status code 0 for success, 1 for failures
  5. Support an optional --verbose flag for detailed connection information

Implementation Details

Create a Python script test_db_connections.py that provides a command-line interface. The script should:

  • Use argparse to handle command-line arguments (database URI required, --verbose optional)
  • Perform a database connection test
  • Print clear success or error messages to stdout
  • Exit with appropriate status codes

Test Cases

  • Running the tool with a valid SQLite database URI (e.g., "sqlite:///test.db") displays a success message and exits with code 0 @test
  • Running the tool with an invalid database URI (e.g., "invalid://bad_uri") displays an error message and exits with code 1 @test
  • Running the tool with no arguments displays usage help information and exits with code 2 @test
  • Running the tool with a valid database URI and the --verbose flag includes detailed connection information in the output @test

Implementation

@generates

API

def test_database_connection(database_uri: str, verbose: bool = False) -> dict:
    """
    Test a database connection and return the results.

    Args:
        database_uri: SQLAlchemy database URI to test
        verbose: If True, return detailed connection information

    Returns:
        Dictionary with keys:
        - 'success': bool indicating if connection succeeded
        - 'message': str with result message
        - 'details': dict with additional information (when verbose=True)
    """
    pass

def main():
    """
    Main CLI entry point that parses arguments and executes the connection test.
    Uses argparse to handle command-line arguments and calls test_database_connection.
    Exits with status code 0 on success, 1 on failure.
    """
    pass

Dependencies { .dependencies }

apache-superset { .dependency }

Provides database connection testing capabilities through its CLI infrastructure and database models.

Install with Tessl CLI

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

tile.json