LakeQL
Overview
  • Introduction
  • Hive Table Manager
Write Pipeline
  • executeWritePipeline
  • Load Strategies
  • Partitioning
Storage
  • Storage Operations
  • API Reference
GitHub
LakeQL
  1. Adapters
  2. Storage
  3. Storage Operations

On this page

  1. createStorageOperations
  2. Configuration
  3. Operations
  4. Environment variables
    1. S3
    2. MinIO
  5. Error handling

Storage Operations

Low-level S3/MinIO storage operations for uploading and managing Parquet files.

Storage operations provide the low-level interface for interacting with S3 or S3-compatible object storage. The write pipeline uses these internally, but they are exported for advanced use cases.

createStorageOperations #

Creates a storage operations instance backed by files-sdk. The adapter selection is based on config.type:

  • "s3" — reads credentials from AWS_* environment variables
  • "minio" — reads credentials from MINIO_* environment variables
1
2
3
4
5
6
7
8
import { createStorageOperations } from "@lakeql/adapters"

const storage = createStorageOperations({
  type: "minio",
  bucket: "my-datalake",
  endpoint: "http://localhost:9000",
})

Configuration #

PropertyType
typeStorageType

Storage adapter type.

Default: "s3"
bucketstring

Bucket name.

region?string

Region override. Falls back to AWS_DEFAULT_REGION env var for S3.

endpoint?string

Custom endpoint. Required for MinIO, optional for S3 (falls back to AWS_ENDPOINT_URL env var).

Operations #

The returned object provides these methods:

MethodDescription
upload(buffer, path)Upload a Uint8Array to the given path in the bucket
deletePrefix(prefix)Delete all objects under the given prefix

Environment variables #

S3 #

VariableDescription
AWS_ACCESS_KEY_IDAWS access key
AWS_SECRET_ACCESS_KEYAWS secret key
AWS_DEFAULT_REGIONDefault region
AWS_ENDPOINT_URLOptional custom endpoint

MinIO #

VariableDescription
MINIO_ACCESS_KEY_IDMinIO access key
MINIO_SECRET_ACCESS_KEYMinIO secret key
The endpoint field in the config is required for MinIO. For S3, it's optional and defaults to the standard AWS endpoint for the region.

Error handling #

Storage errors are wrapped in a StorageError with a descriptive message including the operation and path:

1
2
3
4
5
6
7
8
9
10
11
import { StorageError } from "@lakeql/adapters"

try {
  await storage.upload(buffer, "path/to/file.parquet")
} catch (error) {
  if (error instanceof StorageError) {
    console.error(error.message)
    // "Storage upload failed for "path/to/file.parquet": The specified bucket does not exist"
  }
}

Error class for storage operation failures, providing path and operation context.

Constructor

new StorageError(message, path, operation, options?)

Parameters

ParameterTypeDefault Value
messagestring—
pathstring—
operation"upload" | "delete"—
options?ErrorOptions | undefined—

Properties

PropertyTypeDefault Value
pathstring—
Modifiers:public, readonly
operation"upload" | "delete"—
Modifiers:public, readonly

Extends

Error

Previous page

Storage