Code Execution SDK
Quick reference for accessing project data from code nodes. Both clients are pre-installed and auto-authenticated.
LibraryClient
Access project files: list, upload, download, and delete.
JavaScript
const { LibraryClient } = require('@intellectible/execution-sdk');
const library = new LibraryClient();
| Method | Returns | Description |
|---|---|---|
listFiles(path?) | FileMetadata[] | List files at a given path (default: root) |
listDirs(path?) | DirMetadata[] | List directories at a given path (default: root) |
createDownloadUrl(fileId) | string | Get signed download URL |
uploadFile(name, type, content, path?) | string | Upload file, returns doc ID |
deleteFile(fileId) | void | Delete a file |
Python
from intellectible_execution import LibraryClient
library = LibraryClient()
| Method | Returns | Description |
|---|---|---|
list_files(path?) | List[Dict] | List files at a given path (default: root) |
list_dirs(path?) | List[Dict] | List directories at a given path (default: root) |
create_download_url(file_id) | str | Get signed download URL |
upload_file(name, type, content, path?) | str | Upload file, returns doc ID |
delete_file(file_id) | None | Delete a file |
Full LibraryClient documentation
DatabaseClient
Access project PostgreSQL databases: create tables, query data, insert rows.
JavaScript
const { DatabaseClient } = require('@intellectible/execution-sdk');
const database = new DatabaseClient();
Database & Table Operations
| Method | Returns | Description |
|---|---|---|
listDatabases() | {id, name, createdDate}[] | List all databases |
listTables(databaseId) | string[] | List tables in a database |
createTable(databaseId, tableId) | string | Create a table |
deleteTable(databaseId, tableId) | void | Delete a table |
Column Operations
| Method | Returns | Description |
|---|---|---|
createColumn(dbId, tblId, colId, colType, opts?) | string | Add column to table |
deleteColumn(databaseId, tableId, colId) | void | Delete a column |
Row Operations
| Method | Returns | Description |
|---|---|---|
query(databaseId, tableId, sqlQuery) | Object[] | Run a SQL query, returns matching rows |
insertRows(databaseId, tableId, rows) | string[] | Insert rows, returns row IDs |
updateCell(dbId, tblId, rowId, colId, value) | void | Update a single cell |
deleteRows(databaseId, tableId, rowIds) | void | Delete multiple rows |
uploadCSV(databaseId, tableId, docId) | object | Import CSV from library |
Python
from intellectible_execution import DatabaseClient
database = DatabaseClient()
Database & Table Operations
| Method | Returns | Description |
|---|---|---|
list_databases() | List[Dict] | List all databases |
list_tables(database_id) | List[str] | List tables in a database |
create_table(database_id, table_id) | str | Create a table |
delete_table(database_id, table_id) | None | Delete a table |
Column Operations
| Method | Returns | Description |
|---|---|---|
create_column(db_id, tbl_id, col_id, col_type, ...) | str | Add column to table |
delete_column(database_id, table_id, col_id) | None | Delete a column |
Row Operations
| Method | Returns | Description |
|---|---|---|
query(database_id, table_id, sql_query) | List[Dict] | Run a SQL query, returns matching rows |
insert_rows(database_id, table_id, rows) | List[str] | Insert rows, returns row IDs |
update_cell(db_id, tbl_id, row_id, col_id, value) | None | Update a single cell |
delete_rows(database_id, table_id, row_ids) | None | Delete multiple rows |
upload_csv(database_id, table_id, doc_id) | Dict | Import CSV from library |
Full DatabaseClient documentation
Column Types
| Type | Description |
|---|---|
text | Text/string data |
number | Numeric data with arbitrary precision |
boolean | True/false values |
vector | pgvector embeddings (use colTypeParam for dimension, 1-2000) |
json | JSON data |
jsonb | Binary JSON (faster queries, recommended) |
tsvector | Full-text search vectors |
Quick Examples
Download and process a file
const files = await library.listFiles();
const url = await library.createDownloadUrl(files[0].id);
const response = await fetch(url);
const content = await response.text();
Upload a file
const docId = await library.uploadFile('results.csv', 'csv', csvData);
Query database rows
const rows = await database.query(dbId, 'users', 'SELECT * FROM "users" LIMIT 20');
console.log(rows);
Insert rows
const rowIds = await database.insertRows(dbId, 'users', [{
name: 'Alice',
email: 'alice@example.com'
}]);