or run

npx @tessl/cli init
Log in

Version

Files

docs

chart-components.mdchart-plugins.mddata-transformation.mdform-data.mdindex.mdquery-building.md
tile.json

task.mdevals/scenario-3/

SQL Query Validator Service

A Python service that validates and formats SQL queries before execution.

Capabilities

SQL Query Validation

Validates SQL queries to ensure they are syntactically correct before execution.

  • Given a valid SELECT query "SELECT * FROM users", validation returns success @test
  • Given an invalid SQL query with syntax errors "SELECT FROM WHERE", validation returns failure with error information @test

SQL Query Formatting

Formats SQL queries to improve readability and maintain consistent code style.

  • Given an unformatted query "select id,name from users where active=1", the formatter returns a properly formatted SQL string with improved spacing @test
  • Given already formatted SQL, the formatter preserves the formatting @test

Implementation

@generates

API

def validate_sql(query: str, database_uri: str) -> dict:
    """
    Validates a SQL query for syntax and safety.

    Args:
        query: The SQL query string to validate
        database_uri: The database connection URI

    Returns:
        A dictionary with 'valid' (bool) and 'errors' (list) keys
    """
    pass

def format_sql(query: str) -> str:
    """
    Formats a SQL query for readability.

    Args:
        query: The SQL query string to format

    Returns:
        A formatted SQL query string with proper indentation and keyword casing
    """
    pass

Dependencies { .dependencies }

apache-superset { .dependency }

Provides SQL validation and formatting capabilities through the SQL Lab module.

@satisfied-by