LogoLogo
HomeBlogGet a Demo
  • Introduction
  • Install Lunar
  • Learn the basics
  • 📖Docs
    • Key concepts
    • Component JSON
    • Catalog JSON
    • Lunar CLI Reference
  • 📝Configuration
    • lunar-config.yml
      • catalogers
      • catalogers/hooks
      • domains
      • components
      • collectors
      • collectors/hooks
      • policies
    • lunar.yml
  • 🛠️Plugin SDKs
    • Plugins configuration
      • lunar-cataloger.yml
      • lunar-collector.yml
      • lunar-policy.yml
    • Bash SDK
      • Cataloger
      • Collector
    • Python SDK
      • Collector
      • Policy
        • Check
        • CheckStatus
        • Path
        • PolicyContext
        • NoDataError
        • Utility Functions
  • ⚙️SQL API
    • Overview
    • Views
      • domains
      • components
      • component_deltas
      • initiatives
      • policies
      • checks
      • prs
      • catalog
Powered by GitBook

©️ Earthly Technologies

On this page
  • Accessing the SQL API
  • Available Views
  1. SQL API

Overview

The SQL API provides programmatic access to Lunar's data through SQL queries. Through this interface, you can access and analyze information about your components, domains, policies, and more.

Accessing the SQL API

To access the SQL API, use the Lunar CLI command lunar sql connection-string to get a PostgreSQL connection string that can be used with any PostgreSQL client:

# Get the connection string
lunar sql connection-string

# Connect using psql (interactive)
psql $(lunar sql connection-string)

# Execute a query directly
psql $(lunar sql connection-string) -c "SELECT * FROM components LIMIT 5"

The access is read-only and restricted to only the views described in this documentation.

Available Views

For detailed information about available views, explore these pages:

  • domains

  • components

  • component_deltas

  • initiatives

  • policies

  • checks

  • prs

  • catalog

PreviousUtility FunctionsNextViews

Last updated 29 days ago

⚙️