Skip to main content

Update Table

Update table properties such as name, description, and sharing settings using the client.tables.update() method. This operation allows you to modify table metadata without affecting the table schema or data.

Method Signature

client.tables.update(name: string, data: TableUpdateRequest): Promise<ApiResponse<TableRecord>>

Parameters

Method Parameters

ParameterTypeRequiredDescription
namestringCurrent table name to update
dataTableUpdateRequestUpdate data containing the changes

TableUpdateRequest

ParameterTypeRequiredDescription
namestringNew table name (for renaming)
descriptionstringUpdated table description
is_sharedbooleanWhether the table should be shared publicly
note

At least one field must be provided in the update request. The update operation is atomic - all changes are applied together or none are applied.

Return Value

Returns the updated TableRecord with all current properties:

interface TableRecord {
id: string; // Unique table identifier
name: string; // Table name
account_id: string; // Account identifier
internal_db_name: string; // Database name
db_id?: string; // Database UUID
resource_id?: string; // Resource identifier
description?: string; // Table description
type?: string; // Table type
parent_table_id?: string; // Parent table reference
is_deleted: boolean; // Soft-delete status
is_public: boolean; // Public visibility
created_by: string; // Creator identifier
created_at: string; // Creation timestamp
updated_at: string; // Last update timestamp
updated_by: string; // Last updater identifier
source?: "boltic" | "copilot"; // Creation source
account_status?: "active" | "suspended" | "deleted"; // Account status
}

Examples

Update Table Description

import { createClient } from "@boltic/sdk";

const client = createClient("your-api-key");

const { data: updatedTable, error } = await client.tables.update("users", {
description: "Enhanced user management table with additional metadata",
});

if (error) {
console.error("Failed to update table:", error.message);
} else {
console.log("Table updated successfully:");
console.log(`- Name: ${updatedTable.name}`);
console.log(`- Description: ${updatedTable.description}`);
console.log(`- Updated: ${new Date(updatedTable.updated_at).toLocaleString()}`);
}

Rename a Table

// Rename table while keeping other properties
const { data: renamedTable, error } = await client.tables.update("old_products", {
name: "product_catalog",
});

if (error) {
if (error.code === "TABLE_NAME_EXISTS") {
console.log('A table with name "product_catalog" already exists');
} else {
console.error("Failed to rename table:", error.message);
}
} else {
console.log(`Table renamed from "old_products" to "${renamedTable.name}"`);
}

Update Multiple Properties

// Update multiple properties in a single operation
const { data: table, error } = await client.tables.update("products", {
name: "product_inventory",
description: "Complete product inventory management system",
is_shared: true, // Make table publicly accessible
});

if (error) {
console.error("Failed to update table:", error.message);
} else {
console.log("Table updated successfully:");
console.log(`- New name: ${table.name}`);
console.log(`- Description: ${table.description}`);
console.log(`- Public access: ${table.is_public ? "Yes" : "No"}`);
}