SDK Client¶
The Client class is the main entry point for the DeepLake SDK.
Client()¶
Create a new client instance.
TypeScript: WASM initialization
The TypeScript SDK requires await initializeWasm() before creating a client. This loads the WebAssembly module that powers the C++ core. Call it once at startup. The applyStorageCreds("readwrite") call injects cloud storage credentials into the WASM engine and resolves the orgId - required for dataset writes.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
token |
str |
No | DeepLake API token. Falls back to DEEPLAKE_API_KEY environment variable. |
workspace_id |
str |
No | Target workspace identifier. Falls back to DEEPLAKE_WORKSPACE environment variable. |
api_url |
str |
No | API server URL. Falls back to DEEPLAKE_API_URL environment variable. |
| Parameter | Type | Required | Description |
|---|---|---|---|
token |
string |
Yes | DeepLake API token. |
workspaceId |
string |
No | Target workspace identifier. Default: "default". |
apiUrl |
string |
No | API server URL. Default: https://api.deeplake.ai. |
org_id is always extracted from the token JWT claims automatically. If the token does not contain an OrgID claim, the client falls back to fetching it from the /me API endpoint.
Dataset root path is fetched from the PostgreSQL GUC deeplake.root_path automatically. No manual configuration is needed.
Examples¶
Environment Variables¶
| Variable | Description | Default |
|---|---|---|
DEEPLAKE_API_KEY |
API token | -- |
DEEPLAKE_WORKSPACE |
Workspace ID | -- |
DEEPLAKE_API_URL |
API base URL | https://api.deeplake.ai |
list_tables()¶
Returns the names of all tables in the current workspace.
Examples¶
drop_table()¶
Drops (deletes) a table from the workspace.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
table_name |
str |
yes | Name of the table to drop. |
if_exists |
bool |
no | If True, do not raise an error if the table is absent. Default: True |
| Parameter | Type | Required | Description |
|---|---|---|---|
tableName |
string |
yes | Name of the table to drop. |
ifExists |
boolean |
no | If true, do not throw if the table is absent. Default: true |
Examples¶
open_table()¶
Open a managed table for direct dataset access. Bypasses PostgreSQL and returns the native dataset object.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
table_name / tableName |
str / string |
yes | Table name (must have been created via ingest()). |
When to use: Training loops, batch iteration, PyTorch/TensorFlow DataLoaders (Python), or direct field-level reads/writes (TypeScript).
Python: Batch Iteration & DataLoaders¶
Python: TQL Filtering¶
TypeScript: Direct Data Access¶
The TypeScript SDK provides field-level read/write methods via the client:
// Get a single field value
const text = await client.getField("my_table", 0, "text");
// Get an entire row (selected columns)
const row = await client.getRow("my_table", 0, ["text", "score", "count"]);
// -> { text: "hello world", score: 0.9, count: 10 }
// Get a column slice
const scores = await client.getColumnData("my_table", "score", 0, 3);
// -> [0.9, 0.8, 0.7]
// Get row count
const numRows = await client.getNumRows("my_table");