hub
Warehousing and transformation layer backed by Redshift Data API.
hub
Hub domain — warehousing and transformation layer.
Dataset
new Dataset(name, provider)
| Param | Type | Description |
|---|---|---|
| name | string | Dataset name as shown in the Beem application |
| provider | Object | Warehouse provider |
dataset.latest() ⇒ Promise.<(string|null)>
Returns the identifier of the latest dataset version.
Example
const latest = await dataset.latest();
// "my_dataset_1612971351"dataset.versions([options]) ⇒ Promise.<Array.<Object>>
Returns available versions ordered from latest to oldest.
| Param | Type | Default |
|---|---|---|
| [options] | object | |
| [options.limit] | number | 15 |
Example
const versions = await dataset.versions({ limit: 5 });
// [{ name: "my_dataset_1612971351", timestamp: "2021-02-10T..." }, ...]dataset.rows(id, [options]) ⇒ Promise.<Array.<Object>>
Returns rows for a specific dataset version.
| Param | Type | Default | Description |
|---|---|---|---|
| id | string | Full dataset identifier including timestamp | |
| [options] | object | ||
| [options.limit] | number | 50 |
Example
const rows = await dataset.rows("my_dataset_1612971351", { limit: 100 });
// [{ col1: "value", col2: 42 }, ...]validateProvider(provider) ⇒ WarehouseProvider
Validates that a provider satisfies the WarehouseProvider contract.
| Param | Type |
|---|---|
| provider | object |
getProvider() ⇒ Promise.<WarehouseProvider>
Returns the active warehouse provider. Creates the default AWS Redshift provider if none set. Note: the default provider requires async initialization (SSM credential fetch).
setProvider(provider)
Replaces the active warehouse provider.
| Param | Type |
|---|---|
| provider | WarehouseProvider |
createDataset(name) ⇒ Dataset
Creates a Dataset instance for querying a named dataset.
| Param | Type | Description |
|---|---|---|
| name | string | Dataset name as shown in the Beem application |
Example
const { hub } = require("@beem/sdk");
const dataset = hub.Dataset("my_dataset");
const latest = await dataset.latest();
const rows = await dataset.rows(latest, { limit: 100 });query(sql, [params]) ⇒ Promise.<Array.<object>>
Executes a raw SQL query against the warehouse.
| Param | Type | Description |
|---|---|---|
| sql | string | SQL statement |
| [params] | Array.<{name: string, value: any}> | Query parameters |
Example
const { hub } = require("@beem/sdk");
const results = await hub.query("SELECT * FROM my_table LIMIT 10");WarehouseProvider : object
Properties
| Name | Type |
|---|---|
| execute | function |
Updated 7 days ago
