Introduction to Leger
Welcome to the official documentation for Leger: Enterprise Analytics. Leger is the unified analytics platform designed for data-driven enterprise teams. It bridges the gap between raw data warehouses and business-ready insights, providing a governed, scalable, and collaborative semantic layer.
New to Leger? Start with the Quickstart guide to deploy your first workspace in under 15 minutes.
Quickstart
Getting up and running with Leger requires three simple steps: provisioning a workspace, connecting your data warehouse, and defining your first semantic model.
- Navigate to the Leger Dashboard and create a new Organization.
- Generate an API Key from
Settings > API Keys. - Use the Leger CLI to authenticate and initialize your project.
# Install the Leger CLI
npm install -g @leger/cli
# Authenticate with your API key
leger auth login --key "lg_live_8x92...k29"
# Initialize a new semantic layer project
leger init my-enterprise-analytics
Authentication
All API requests to Leger must be authenticated using a Bearer token. You can generate API keys from the dashboard under Settings > API Keys. We recommend using environment variables to store your keys securely.
| Header | Value | Description |
|---|---|---|
Authorization |
Bearer <API_KEY> |
Required for all authenticated endpoints. |
Content-Type |
application/json |
Required for POST and PUT requests. |
X-Leger-Version |
2024-08-01 |
Optional. Pins the API to a specific version. |
The Semantic Layer
The semantic layer is the core of Leger. It translates raw database tables into business-friendly metrics and dimensions. By defining your logic in YAML, you ensure that "Net Revenue" means the exact same thing to the CFO as it does to the VP of Sales.
Best Practice: Never define complex business logic directly in your BI tool. Push it down to the Leger Semantic Layer to ensure consistency across all downstream consumers.
Defining a Data Model
Models are defined in YAML files within your project's /models directory. Below is an example of a standard revenue model.
model:
name: revenue
description: "Aggregated daily revenue by account."
sql: "SELECT * FROM raw.transactions"
dimensions:
- name: account_id
type: string
- name: transaction_date
type: date
measures:
- name: total_revenue
type: sum
sql: "amount"
- name: avg_deal_size
type: average
sql: "amount"
RBAC & Security
Leger provides enterprise-grade Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC). You can restrict data access at the row and column level based on user attributes like region, department, or role.
- Row-Level Security (RLS): Automatically filters query results based on the user's attributes.
- Column-Level Masking: Dynamically masks PII (e.g., emails, SSNs) for unauthorized users.
- Immutable Audit Logs: Every query, export, and configuration change is logged with a 7-year retention policy.
Compliance: Leger is SOC 2 Type II certified, GDPR compliant, and HIPAA ready. We support customer-managed encryption keys (CMEK) for data at rest.