LakeQL
Introduction
  • Overview
  • Why LakeQL
  • Key Concepts
Getting Started
  • Prerequisites
  • Quickstart
  • Environment
  • First Run
Architecture
  • System Overview
  • Data Flow
  • Request Lifecycle
Configuration
  • Config File
  • Runtime Lifecycle
  • Environment Variables
create-app
  • Usage
  • Template Structure
  • Post-Creation
Guides
  • Custom Resolvers
  • Extending the Schema
  • Mutations
  • Set Up a Trino Mutation
  • Deploying
Endpoints
  • Definition Format
  • Field Types
  • Nested Fields
  • Mutations
  • Glossary
Contributing
  • Local Development
  • Contribution Guide
  • Architecture
GitHub
LakeQL
  1. LakeQL
  2. Configuration
  3. Runtime Lifecycle

Runtime Lifecycle

How config is loaded and composed into a runtime.

Loading the config never opens a connection. An application composes a runtime explicitly, in three steps:

1
2
3
4
5
6
7
8
9
10
11
12
import { createLakeQLRuntime, loadConfig } from "@lakeql/config"

const project = await loadConfig() // load + validate
const runtime = await createLakeQLRuntime({
  // compose
  config: project.config,
  adapters: project.adapters,
  resolveAuth,
})
// ... use runtime.getDataSource(name) / getReadStrategy(name)
await runtime.close() // release on shutdown
  1. Load — loadConfig reads the config. Environment values are read by the config module itself as it is evaluated. Per-source validation against the adapter happens in defineConfig (at module evaluation) and again in the adapter factory when the data source is created — not in loadConfig itself.
  2. Compose — createLakeQLRuntime builds the runtime, which owns the data-source instances and their strategies.
  3. Close — runtime.close() releases all connections, once, idempotently.

Nothing is global, so an application can hold more than one runtime. That helps with config reloads (compose the new runtime, then close the old) and tests.

For the full contract, options, and error cases, see the runtime config reference in @lakeql/config. Wire close() to your process signals as shown in server setup.

Previous page

Config File

Next page

Environment Variables