Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 1.86 KB

client.md

File metadata and controls

55 lines (41 loc) · 1.86 KB

Client Instance Guide

The library provides two distinct clients to handle the subtle differences between Dremio Cloud and Dremio Software APIs. Both clients share a common interface for most resources, making it easy to switch between them or support hybrid deployments.

Dremio Cloud Client

The DremioCloudClient is optimized for Dremio Cloud's multi-tenant architecture. It automatically handles the projectId context required for most API calls.

import { DremioCloudClient } from 'dremiojs';

const cloudClient = new DremioCloudClient({
    baseUrl: 'https://api.dremio.cloud/v0',
    authToken: process.env.DREMIO_CLOUD_TOKEN,
    projectId: process.env.DREMIO_CLOUD_PROJECT_ID
});

// The client automatically appends /projects/{id} to relevant paths
await cloudClient.catalog.getByPath(['space', 'dataset']);

Dremio Software Client

The DremioSoftwareClient supports standard Dremio Software deployments (Docker, K8s, RPM). It includes logic for:

  • API v2 Login (username/password) exchange for tokens.
  • Automatic token management (if using username/pass).
  • Standard v3 API usage.
import { DremioSoftwareClient } from 'dremiojs';

const softwareClient = new DremioSoftwareClient({
    baseUrl: 'http://localhost:9047/api/v3',
    authToken: process.env.DREMIO_PAT 
});

// Or using Login
const legacyClient = new DremioSoftwareClient({
    baseUrl: 'http://localhost:9047/api/v3',
    username: 'admin',
    password: 'password123'
});

// The client performs login on the first request if no token is present
await legacyClient.jobs.executeQuery('SELECT 1'); 

Shared Capabilities

Both clients extend BaseClient and expose:

  • catalog: Manage datasets, spaces, folders.
  • jobs: Execute SQL and track jobs.
  • reflections: specific Reflection management.
  • sources: specific Source management.
  • users: User and Role lookups.