dremiojs
v1.2.0
Published
A TypeScript client library for Dremio Cloud and Software.
Readme
dremiojs
Type-safe Node.js client for Dremio API. Supporting Dremio Cloud and Dremio Software (v2/v3).
Installation
npm install dremiojsUsage
The recommended way to use dremiojs is by configuring your connection in ~/.dremio/profiles.yaml (compatible with dremio-cli).
1. Setup Profile
Create ~/.dremio/profiles.yaml:
profiles:
cloud:
type: cloud
base_url: https://api.dremio.cloud
project_id: <PROJECT_ID>
auth:
type: pat
token: <PAT>
local:
type: software
base_url: http://localhost:9047
auth:
type: username_password
username: admin
password: password1
default_profile: cloud2. Connect & Query
import { Dremio } from 'dremiojs';
async function main() {
// Automatically loads 'default' profile from yaml
const client = await Dremio.fromProfile();
// Execute SQL
const results = await client.jobs.executeQuery('SELECT 1');
console.log(results);
}Advanced Usage (Explicit Configuration)
You can also configure clients manually without a profile file.
Dremio Cloud
import { DremioCloudClient } from 'dremiojs';
const client = new DremioCloudClient({
baseUrl: 'https://api.dremio.cloud/v0',
authToken: 'YOUR_PAT',
projectId: 'YOUR_PROJECT_ID'
});Dremio Software
import { DremioSoftwareClient } from 'dremiojs';
// OAuth (Client Credentials)
const client = new DremioSoftwareClient({
baseUrl: 'https://dremio.local/api/v3',
auth: {
type: 'oauth',
client_id: 'service-id',
client_secret: 'secret'
}
});Features
Profile Support: Seamless
profiles.yamlintegration for Cloud/Software.Advanced Auth: Support for PAT Exchange and OAuth Client Credentials.
Universal Support: Works with both Dremio Cloud and Dremio Software.
Strict Typing: Full TypeScript definitions for Catalog, Jobs, Reflections, etc.
SQL Helper: Easy
executeQuerymethod that handles job submission and polling.Catalog Management: Create, update, delete Spaces, Sources, Folders, and Datasets.
Reflections: Manage reflections programmatically.
