Skip to main content

A continuous integration tool for Looker and LookML validation

Project description

Looker Validator

A command-line tool designed for integrating Looker project validation into CI/CD pipelines. It helps ensure the quality and integrity of your LookML code, content, SQL generation, and data assertions.

Features

  • LookML Validation: Checks LookML syntax, references, and adherence to best practices using Looker's native validator.
  • Content Validation: Validates Looks and Dashboards, checking for errors like broken field references or invalid filters.
    • Optional exclusion of content in personal folders
    • Supports incremental checks comparing branches
  • SQL Validation: Checks if the SQL generated by Looker for specified explores is valid (by attempting to run queries).
  • Assert Validation (Data Tests): Executes LookML data tests defined within your project to verify data integrity rules.
  • Flexible Configuration: Configure via CLI arguments, environment variables, or a YAML file.
  • CI/CD Friendly: Designed to be easily integrated into workflows (e.g., GitHub Actions).

Installation

  1. Clone the repository containing this tool.
  2. Navigate to the repository's root directory.
  3. Install the tool and its dependencies (including the Looker SDK):
    pip install .
    # Or for development:
    # pip install -e .
    

Configuration

The tool requires Looker API credentials and connection details. These can be provided via:

  • Command-line Arguments
  • Environment Variables
  • YAML Configuration File

Credentials Precedence

  1. Command-line arguments
  2. Environment variables
  3. YAML configuration file
  4. Built-in defaults

Required Credentials

  • LOOKER_BASE_URL / --base-url: Your Looker instance URL (e.g., https://yourcompany.looker.com)
  • LOOKER_CLIENT_ID / --client-id: API Client ID
  • LOOKER_CLIENT_SECRET / --client-secret: API Client Secret

Recommendation: Use environment variables or a secrets management system (like GitHub Secrets) for credentials in CI environments.

Usage

The tool is invoked using the looker-validator command followed by a specific validation command and options:

looker-validator <command> [options]

Commands

Connect

Test the connection to the Looker API:

looker-validator connect --base-url <URL> --client-id <ID> --client-secret <SECRET>
# Or using env vars/config file
looker-validator connect -c looker_validator_config.yaml

LookML Validation

Runs Looker's native LookML validator:

looker-validator lookml --project <your-looker-project-name> --branch <your-branch>
# Fail on warnings or errors
looker-validator lookml --project <...> --branch <...> --severity warning

Content Validation

Validates Looks and Dashboards:

# Validate content on a specific branch (excluding personal folders)
looker-validator content --project <...> --branch <...>

# Include personal folders
looker-validator content --project <...> --branch <...> --include-personal

# Filter by specific explores or folders
looker-validator content --project <...> --branch <...> --explores 'model_a/explore_one' --folders '123' '-456'

# Incremental check against production branch
looker-validator content --project <...> --branch <feature-branch> --incremental

SQL Validation

Validates SQL generated for explores:

looker-validator sql --project <...> --branch <...>
# Validate specific explores with higher concurrency
looker-validator sql --project <...> --branch <...> --explores 'model_a/*' --concurrency 15

Assert Validation

Runs LookML data tests:

looker-validator assert --project <...> --branch <...>
# Run tests only for specific explores
looker-validator assert --project <...> --branch <...> --explores 'model_a/explore_one' 'model_b/*'

Configuration File Example

Create a looker_validator_config.yaml file:

# Connection details (Alternatively use Env Vars or CLI args)
# base_url: https://yourcompany.looker.com
# client_id: your_client_id_from_yaml
# client_secret: your_client_secret_from_yaml

# Common settings
project: "your_primary_looker_project"
timeout: 720
log_dir: "ci_logs"

# Default validator settings
concurrency: 8

# Content validator specific defaults
content:
  folders: ["1", "2", "-99"]
  include_personal: false
  incremental: false

# LookML validator specific defaults
lookml:
  severity: "warning"

# SQL validator specific defaults
sql:
  concurrency: 5

# Assert validator specific defaults
assert:
  concurrency: 5

Options

Detailed options are available for each command. Use looker-validator <command> --help for specific command options.

CI/CD Integration

This tool is ideal for running checks on pull requests or pushes to your Looker project repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

looker_validator-0.2.0.tar.gz (51.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

looker_validator-0.2.0-py3-none-any.whl (57.5 kB view details)

Uploaded Python 3

File details

Details for the file looker_validator-0.2.0.tar.gz.

File metadata

  • Download URL: looker_validator-0.2.0.tar.gz
  • Upload date:
  • Size: 51.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.2

File hashes

Hashes for looker_validator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e0ecea02210e3e1871039f41633b93a1543b397dd485c3dc0569466149f1aa3f
MD5 6b8c3a6ee7a217ad3eab34d6abc48774
BLAKE2b-256 7482732e0095410f60f6b56b402fd5d679cbb46b14b7733b3ce860b241c363b3

See more details on using hashes here.

File details

Details for the file looker_validator-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for looker_validator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b917aff1ebb9c04ce62667c61897adee77efe77bf1c4a9ec1e16366af3af47ea
MD5 abd05f0c13225e5520639ddf4386c8ce
BLAKE2b-256 290c9a43ff6bb16b405bbf51c0c18256076827625d62af1daf6d043189b0349e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page