@databricks/zerobus-ingest-sdk 0.2.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +3 -3
- package/README.md +22 -82
- package/package.json +13 -14
- package/src/lib.rs +4 -1
- package/zerobus-ingest-sdk.darwin-arm64.node +0 -0
- package/zerobus-ingest-sdk.darwin-x64.node +0 -0
- package/zerobus-ingest-sdk.linux-arm64-gnu.node +0 -0
- package/zerobus-ingest-sdk.linux-x64-gnu.node +0 -0
- package/zerobus-ingest-sdk.win32-x64-msvc.node +0 -0
- package/Cargo.lock +0 -2735
- package/LICENSE +0 -69
- package/index.d.ts +0 -538
- package/index.js +0 -318
- package/schemas/air_quality_descriptor.pb +0 -9
- package/schemas/edge_cases_descriptor.pb +0 -41
package/Cargo.toml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "zerobus-sdk-ts"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "1.0.0"
|
|
4
4
|
authors = ["Databricks"]
|
|
5
5
|
edition = "2021"
|
|
6
6
|
license-file = "LICENSE"
|
|
7
7
|
description = "TypeScript/Node.js bindings for the Databricks Zerobus SDK"
|
|
8
|
-
repository = "https://github.com/databricks/zerobus-sdk
|
|
8
|
+
repository = "https://github.com/databricks/zerobus-sdk"
|
|
9
9
|
|
|
10
10
|
[lib]
|
|
11
11
|
crate-type = ["cdylib"]
|
|
@@ -16,7 +16,7 @@ napi = { version = "2", features = ["async", "tokio_rt", "serde-json"] }
|
|
|
16
16
|
napi-derive = "2"
|
|
17
17
|
|
|
18
18
|
# The Rust SDK we're wrapping
|
|
19
|
-
databricks-zerobus-ingest-sdk =
|
|
19
|
+
databricks-zerobus-ingest-sdk = "1.0.0"
|
|
20
20
|
|
|
21
21
|
# Async runtime (same as the Rust SDK)
|
|
22
22
|
tokio = { version = "1.42", features = ["macros", "rt-multi-thread"] }
|
package/README.md
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
# Databricks Zerobus Ingest SDK for TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
We are keen to hear feedback from you on this SDK. Please [file issues](https://github.com/databricks/zerobus-sdk-ts/issues), and we will address them.
|
|
6
|
-
|
|
7
|
-
The Databricks Zerobus Ingest SDK for TypeScript provides a high-performance client for ingesting data directly into Databricks Delta tables using the Zerobus streaming protocol. This SDK wraps the high-performance [Rust SDK](https://github.com/databricks/zerobus-sdk-rs) using native bindings for optimal performance. | See also the [SDK for Rust](https://github.com/databricks/zerobus-sdk-rs) | See also the [SDK for Python](https://github.com/databricks/zerobus-sdk-py) | See also the [SDK for Java](https://github.com/databricks/zerobus-sdk-java) | See also the [SDK for Go](https://github.com/databricks/zerobus-sdk-go)
|
|
3
|
+
The Databricks Zerobus Ingest SDK for TypeScript provides a high-performance client for ingesting data directly into Databricks Delta tables using the Zerobus streaming protocol. This SDK wraps the high-performance [Rust SDK](https://github.com/databricks/zerobus-sdk/tree/main/rust) using native bindings for optimal performance.
|
|
8
4
|
|
|
9
5
|
## Table of Contents
|
|
10
6
|
|
|
11
7
|
- [Features](#features)
|
|
12
8
|
- [Requirements](#requirements)
|
|
13
9
|
- [Quick Start User Guide](#quick-start-user-guide)
|
|
14
|
-
- [Prerequisites](#prerequisites)
|
|
15
10
|
- [Installation](#installation)
|
|
16
11
|
- [Choose Your Serialization Format](#choose-your-serialization-format)
|
|
17
12
|
- [Option 1: Using JSON (Quick Start)](#option-1-using-json-quick-start)
|
|
@@ -25,8 +20,8 @@ The Databricks Zerobus Ingest SDK for TypeScript provides a high-performance cli
|
|
|
25
20
|
- [Best Practices](#best-practices)
|
|
26
21
|
- [Platform Support](#platform-support)
|
|
27
22
|
- [Architecture](#architecture)
|
|
28
|
-
- [Contributing](#contributing)
|
|
29
|
-
- [
|
|
23
|
+
- [Community and Contributing](#community-and-contributing)
|
|
24
|
+
- [License](#license)
|
|
30
25
|
|
|
31
26
|
## Features
|
|
32
27
|
|
|
@@ -67,65 +62,7 @@ These will be installed automatically:
|
|
|
67
62
|
|
|
68
63
|
### Prerequisites
|
|
69
64
|
|
|
70
|
-
Before using the SDK, you
|
|
71
|
-
|
|
72
|
-
#### 1. Workspace URL and Workspace ID
|
|
73
|
-
|
|
74
|
-
After logging into your Databricks workspace, look at the browser URL:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
https://<databricks-instance>.cloud.databricks.com/?o=<workspace-id>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
- **Workspace URL**: The part before `/?o=` → `https://<databricks-instance>.cloud.databricks.com`
|
|
81
|
-
- **Workspace ID**: The part after `?o=` → `<workspace-id>`
|
|
82
|
-
- **Zerobus Endpoint**: `https://<workspace-id>.zerobus.<region>.cloud.databricks.com`
|
|
83
|
-
|
|
84
|
-
> **Note:** The examples above show AWS endpoints (`.cloud.databricks.com`). For Azure deployments, the workspace URL will be `https://<databricks-instance>.azuredatabricks.net` and Zerobus endpoint will use `.azuredatabricks.net`.
|
|
85
|
-
|
|
86
|
-
Example:
|
|
87
|
-
- Full URL: `https://dbc-a1b2c3d4-e5f6.cloud.databricks.com/?o=1234567890123456`
|
|
88
|
-
- Workspace URL: `https://dbc-a1b2c3d4-e5f6.cloud.databricks.com`
|
|
89
|
-
- Workspace ID: `1234567890123456`
|
|
90
|
-
- Zerobus Endpoint: `https://1234567890123456.zerobus.us-west-2.cloud.databricks.com`
|
|
91
|
-
|
|
92
|
-
#### 2. Create a Delta Table
|
|
93
|
-
|
|
94
|
-
Create a table using Databricks SQL:
|
|
95
|
-
|
|
96
|
-
```sql
|
|
97
|
-
CREATE TABLE <catalog_name>.default.air_quality (
|
|
98
|
-
device_name STRING,
|
|
99
|
-
temp INT,
|
|
100
|
-
humidity BIGINT
|
|
101
|
-
)
|
|
102
|
-
USING DELTA;
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Replace `<catalog_name>` with your catalog name (e.g., `main`).
|
|
106
|
-
|
|
107
|
-
#### 3. Create a Service Principal
|
|
108
|
-
|
|
109
|
-
1. Navigate to **Settings > Identity and Access** in your Databricks workspace
|
|
110
|
-
2. Click **Service principals** and create a new service principal
|
|
111
|
-
3. Generate a new secret for the service principal and save it securely
|
|
112
|
-
4. Grant the following permissions:
|
|
113
|
-
- `USE_CATALOG` on the catalog (e.g., `main`)
|
|
114
|
-
- `USE_SCHEMA` on the schema (e.g., `default`)
|
|
115
|
-
- `MODIFY` and `SELECT` on the table (e.g., `air_quality`)
|
|
116
|
-
|
|
117
|
-
Grant permissions using SQL:
|
|
118
|
-
|
|
119
|
-
```sql
|
|
120
|
-
-- Grant catalog permission
|
|
121
|
-
GRANT USE CATALOG ON CATALOG <catalog_name> TO `<service-principal-application-id>`;
|
|
122
|
-
|
|
123
|
-
-- Grant schema permission
|
|
124
|
-
GRANT USE SCHEMA ON SCHEMA <catalog_name>.default TO `<service-principal-application-id>`;
|
|
125
|
-
|
|
126
|
-
-- Grant table permissions
|
|
127
|
-
GRANT SELECT, MODIFY ON TABLE <catalog_name>.default.air_quality TO `<service-principal-application-id>`;
|
|
128
|
-
```
|
|
65
|
+
Before using the SDK, you need a Databricks workspace URL, a Delta table, and a service principal. See the [monorepo prerequisites](https://github.com/databricks/zerobus-sdk/blob/main/README.md#prerequisites) for detailed setup instructions.
|
|
129
66
|
|
|
130
67
|
### Installation
|
|
131
68
|
|
|
@@ -202,10 +139,10 @@ source $HOME/.cargo/env
|
|
|
202
139
|
|
|
203
140
|
**Note for macOS users**: Pre-built binaries are not available. The package will automatically build from source during `npm install`. Ensure you have Rust toolchain and Xcode Command Line Tools installed (see prerequisites above).
|
|
204
141
|
|
|
205
|
-
1.
|
|
142
|
+
1. Clone the repository:
|
|
206
143
|
```bash
|
|
207
|
-
|
|
208
|
-
cd zerobus-sdk
|
|
144
|
+
git clone https://github.com/databricks/zerobus-sdk.git
|
|
145
|
+
cd zerobus-sdk/ts
|
|
209
146
|
```
|
|
210
147
|
|
|
211
148
|
2. Install dependencies:
|
|
@@ -256,7 +193,7 @@ import { ZerobusSdk, RecordType } from '@databricks/zerobus-ingest-sdk';
|
|
|
256
193
|
|
|
257
194
|
// Configuration
|
|
258
195
|
// For AWS:
|
|
259
|
-
const zerobusEndpoint = '
|
|
196
|
+
const zerobusEndpoint = 'https://<workspace-id>.zerobus.<region>.cloud.databricks.com';
|
|
260
197
|
const workspaceUrl = 'https://<workspace-name>.cloud.databricks.com';
|
|
261
198
|
// For Azure:
|
|
262
199
|
// const zerobusEndpoint = '<workspace-id>.zerobus.<region>.azuredatabricks.net';
|
|
@@ -419,7 +356,7 @@ import * as airQuality from './examples/generated/air_quality';
|
|
|
419
356
|
import { loadDescriptorProto } from '@databricks/zerobus-ingest-sdk/utils/descriptor';
|
|
420
357
|
|
|
421
358
|
// Configuration
|
|
422
|
-
const zerobusEndpoint = '
|
|
359
|
+
const zerobusEndpoint = 'https://<workspace-id>.zerobus.<region>.cloud.databricks.com';
|
|
423
360
|
const workspaceUrl = 'https://<workspace-name>.cloud.databricks.com';
|
|
424
361
|
const tableName = 'main.default.air_quality';
|
|
425
362
|
const clientId = process.env.DATABRICKS_CLIENT_ID!;
|
|
@@ -614,7 +551,7 @@ See the `examples/` directory for complete, runnable examples. See [examples/REA
|
|
|
614
551
|
|
|
615
552
|
```bash
|
|
616
553
|
# Set environment variables
|
|
617
|
-
export ZEROBUS_SERVER_ENDPOINT="
|
|
554
|
+
export ZEROBUS_SERVER_ENDPOINT="https://<workspace-id>.zerobus.<region>.cloud.databricks.com"
|
|
618
555
|
export DATABRICKS_WORKSPACE_URL="https://<workspace-name>.cloud.databricks.com"
|
|
619
556
|
export DATABRICKS_CLIENT_ID="your-client-id"
|
|
620
557
|
export DATABRICKS_CLIENT_SECRET="your-client-secret"
|
|
@@ -873,7 +810,7 @@ new ZerobusSdk(zerobusEndpoint: string, unityCatalogUrl: string)
|
|
|
873
810
|
```
|
|
874
811
|
|
|
875
812
|
**Parameters:**
|
|
876
|
-
- `zerobusEndpoint` (string) - The Zerobus gRPC endpoint (e.g.,
|
|
813
|
+
- `zerobusEndpoint` (string) - The Zerobus gRPC endpoint (e.g., `https://<workspace-id>.zerobus.<region>.cloud.databricks.com` for AWS, or `https://<workspace-id>.zerobus.<region>.azuredatabricks.net` for Azure)
|
|
877
814
|
- `unityCatalogUrl` (string) - The Unity Catalog endpoint (your workspace URL)
|
|
878
815
|
|
|
879
816
|
**Methods:**
|
|
@@ -1203,7 +1140,7 @@ The build process happens automatically during installation and typically takes
|
|
|
1203
1140
|
|
|
1204
1141
|
## Architecture
|
|
1205
1142
|
|
|
1206
|
-
This SDK wraps the high-performance [Rust Zerobus SDK](https://github.com/databricks/zerobus-sdk
|
|
1143
|
+
This SDK wraps the high-performance [Rust Zerobus SDK](https://github.com/databricks/zerobus-sdk/tree/main/rust) using [NAPI-RS](https://napi.rs):
|
|
1207
1144
|
|
|
1208
1145
|
```
|
|
1209
1146
|
┌─────────────────────────────┐
|
|
@@ -1228,13 +1165,16 @@ This SDK wraps the high-performance [Rust Zerobus SDK](https://github.com/databr
|
|
|
1228
1165
|
- **Automatic memory management** - No manual cleanup required
|
|
1229
1166
|
- **Type safety** - Compile-time checks on both sides
|
|
1230
1167
|
|
|
1231
|
-
## Contributing
|
|
1168
|
+
## Community and Contributing
|
|
1169
|
+
|
|
1170
|
+
This is an open source project. We welcome contributions, feedback, and bug reports.
|
|
1232
1171
|
|
|
1233
|
-
|
|
1172
|
+
- **[Contributing Guide](https://github.com/databricks/zerobus-sdk/blob/main/typescript/CONTRIBUTING.md)**: TypeScript-specific development setup and workflow.
|
|
1173
|
+
- **[General Contributing Guide](https://github.com/databricks/zerobus-sdk/blob/main/CONTRIBUTING.md)**: Pull request process, commit requirements, and policies.
|
|
1174
|
+
- **[Changelog](https://github.com/databricks/zerobus-sdk/blob/main/typescript/CHANGELOG.md)**: See the history of changes in the SDK.
|
|
1175
|
+
- **[Security Policy](https://github.com/databricks/zerobus-sdk/blob/main/SECURITY.md)**: Read about our security process and how to report vulnerabilities.
|
|
1176
|
+
- **[Developer Certificate of Origin (DCO)](https://github.com/databricks/zerobus-sdk/blob/main/DCO)**: Understand the agreement for contributions.
|
|
1234
1177
|
|
|
1235
|
-
##
|
|
1178
|
+
## License
|
|
1236
1179
|
|
|
1237
|
-
|
|
1238
|
-
- [Zerobus Python SDK](https://github.com/databricks/zerobus-sdk-py) - Python SDK for Zerobus
|
|
1239
|
-
- [Zerobus Java SDK](https://github.com/databricks/zerobus-sdk-java) - Java SDK for Zerobus
|
|
1240
|
-
- [NAPI-RS](https://napi.rs) - Rust/Node.js binding framework
|
|
1180
|
+
This SDK is licensed under the Databricks License. See the [LICENSE](https://github.com/databricks/zerobus-sdk/blob/main/LICENSE) file for the full license text. The license is also available online at [https://www.databricks.com/legal/db-license](https://www.databricks.com/legal/db-license).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@databricks/zerobus-ingest-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "TypeScript/Node.js SDK for streaming data ingestion into Databricks Delta tables using Zerobus",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/databricks/zerobus-sdk
|
|
18
|
+
"url": "https://github.com/databricks/zerobus-sdk"
|
|
19
19
|
},
|
|
20
20
|
"license": "Databricks License",
|
|
21
21
|
"files": [
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
"napi": {
|
|
35
35
|
"name": "zerobus-ingest-sdk",
|
|
36
36
|
"triples": {
|
|
37
|
-
"defaults":
|
|
37
|
+
"defaults": false,
|
|
38
38
|
"additional": [
|
|
39
|
-
"x86_64-unknown-linux-
|
|
39
|
+
"x86_64-unknown-linux-gnu",
|
|
40
40
|
"aarch64-unknown-linux-gnu",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"x86_64-pc-windows-msvc",
|
|
42
|
+
"x86_64-apple-darwin",
|
|
43
|
+
"aarch64-apple-darwin"
|
|
43
44
|
]
|
|
44
45
|
}
|
|
45
46
|
},
|
|
@@ -92,12 +93,10 @@
|
|
|
92
93
|
"glob": "^10.0.0"
|
|
93
94
|
},
|
|
94
95
|
"optionalDependencies": {
|
|
95
|
-
"@databricks/zerobus-ingest-sdk-
|
|
96
|
-
"@databricks/zerobus-ingest-sdk-
|
|
97
|
-
"@databricks/zerobus-ingest-sdk-
|
|
98
|
-
"@databricks/zerobus-ingest-sdk-
|
|
99
|
-
"@databricks/zerobus-ingest-sdk-
|
|
100
|
-
"@databricks/zerobus-ingest-sdk-darwin-arm64": "0.2.0",
|
|
101
|
-
"@databricks/zerobus-ingest-sdk-linux-arm64-musl": "0.2.0"
|
|
96
|
+
"@databricks/zerobus-ingest-sdk-linux-x64-gnu": "1.0.0",
|
|
97
|
+
"@databricks/zerobus-ingest-sdk-linux-arm64-gnu": "1.0.0",
|
|
98
|
+
"@databricks/zerobus-ingest-sdk-win32-x64-msvc": "1.0.0",
|
|
99
|
+
"@databricks/zerobus-ingest-sdk-darwin-x64": "1.0.0",
|
|
100
|
+
"@databricks/zerobus-ingest-sdk-darwin-arm64": "1.0.0"
|
|
102
101
|
}
|
|
103
|
-
}
|
|
102
|
+
}
|
package/src/lib.rs
CHANGED
|
@@ -901,7 +901,10 @@ impl ZerobusSdk {
|
|
|
901
901
|
Error::from_reason("Failed to extract workspace_id from zerobus_endpoint".to_string())
|
|
902
902
|
})?;
|
|
903
903
|
|
|
904
|
-
let inner = RustZerobusSdk::
|
|
904
|
+
let inner = RustZerobusSdk::builder()
|
|
905
|
+
.endpoint(&zerobus_endpoint)
|
|
906
|
+
.unity_catalog_url(&unity_catalog_url)
|
|
907
|
+
.build()
|
|
905
908
|
.map_err(|e| Error::from_reason(format!("Failed to create SDK: {}", e)))?;
|
|
906
909
|
|
|
907
910
|
Ok(ZerobusSdk {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|