beekeeper-studio/beekeeper-studio · warning

DynamoDB does not support truncation — drop and recreate ins

Error message

DynamoDB does not support truncation — drop and recreate instead

What it means

DynamoDBClient.truncateElement() always throws because DynamoDB has no TRUNCATE operation. Empties are performed by deleting and recreating the table, or by deleting all items (slow and consumes throughput). The message tells the user the drop-and-recreate workaround directly.

Source

Thrown at apps/studio/src-commercial/backend/lib/db/clients/dynamodb.ts:903

  async getRoutineCreateScript(): Promise<string[]> {
    throw new Error('DynamoDB does not support routines');
  }

  async setElementName(): Promise<void> {
    throw new Error('DynamoDB does not support renaming tables');
  }

  async setElementNameSql(): Promise<string> {
    throw new Error('DynamoDB does not support renaming tables');
  }

  async setTableDescription(): Promise<string> {
    throw new Error('DynamoDB does not support table descriptions');
  }

  async truncateElement(): Promise<void> {
    throw new Error('DynamoDB does not support truncation — drop and recreate instead');
  }

  async truncateElementSql(): Promise<string> {
    throw new Error('DynamoDB does not support truncation');
  }

  async truncateAllTables(): Promise<void> {
    throw new Error('DynamoDB does not support truncation');
  }

  async duplicateTable(): Promise<void> {
    throw new Error('DynamoDB does not support duplicating tables');
  }

  async duplicateTableSql(): Promise<string> {
    throw new Error('DynamoDB does not support duplicating tables');
  }

View on GitHub (pinned to 4e3e03e322)

Solutions

  1. Drop and recreate the table with the same key schema/indexes (as the error message suggests)
  2. Use aws dynamodb delete-item loops or a parallel scan+delete only for small tables
  3. Disable 'Truncate' in the UI and offer 'Drop' with a recreate helper

Example fix

// before
await client.truncateElement('users', 'table');
// after
// DynamoDB: no truncate; drop & recreate
const desc = await client.tableDescription('users');
await client.dropElement('users', 'table');
await recreateTable(desc);
Defensive patterns

Strategy: try-catch

Validate before calling

if (isDynamoDBClient(client)) {
  return proposeDropAndRecreate(table); // no TRUNCATE in DynamoDB
}

Type guard

const supportsTruncate = (c: unknown): boolean => !(c instanceof DynamoDBClient);

Try / catch

try {
  await client.truncateElement(table, 'table');
} catch (e) {
  if (e.message.includes('does not support truncation')) {
    await dropAndRecreateTable(client, table);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling DynamoDBClient.truncateElement() or the UI 'Truncate table' action on a DynamoDB table.

Common situations: Test data cleanup flows; users switching from SQL databases who expect truncate to exist.

Related errors


AI-assisted analysis of beekeeper-studio/beekeeper-studio@4e3e03e322 (2026-08-31). Data as JSON: /api/errors/3d688d01f4e821b7. Report an issue: GitHub.