beekeeper-studio/beekeeper-studio · info

DynamoDB does not expose CREATE TABLE SQL

Error message

DynamoDB does not expose CREATE TABLE SQL

What it means

DynamoDBClient.getTableCreateScript() always throws. DynamoDB tables are created via the AWS API (CreateTable with key schema, indexes, billing mode), not SQL CREATE TABLE statements, so no create script can be produced.

Source

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

      }));
    }
  }

  // -------------------- unsupported operations ---------------------
  getBuilder(table: string, schema?: string): ChangeBuilderBase {
    return new DynamoDBChangeBuilder(table, schema);
  }

  async createDatabase(): Promise<string> {
    throw new Error('DynamoDB does not support creating databases');
  }

  async createDatabaseSQL(): Promise<string> {
    throw new Error('DynamoDB does not support generating SQL');
  }

  async getTableCreateScript(): Promise<string> {
    throw new Error('DynamoDB does not expose CREATE TABLE SQL');
  }

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

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

  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');
  }

View on GitHub (pinned to 4e3e03e322)

Solutions

  1. Use the table's description (key schema, GSIs/LSIs, billing mode) to reconstruct an aws dynamodb create-table CLI/SDK call instead
  2. Hide or disable 'Copy create script' for DynamoDB tables
  3. Catch the error and offer table details JSON export as an alternative

Example fix

// before
const ddl = await client.getTableCreateScript('users');
// after
const ddl = client.connectionType === 'dynamodb'
  ? buildCreateTableCli(await client.tableDescription('users'))
  : await client.getTableCreateScript('users');
Defensive patterns

Strategy: try-catch

Validate before calling

if (isDynamoDBClient(client)) {
  const desc = await client.tableDetails(table);
  return toCreateTableCliScript(desc);
}

Type guard

const isDynamoDB = (c: unknown): c is DynamoDBClient => c instanceof DynamoDBClient;

Try / catch

try {
  return await client.getTableCreateScript(table);
} catch (e) {
  if (e.message.includes('does not expose CREATE TABLE')) {
    return exportTableSchemaAsJson(table);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling DynamoDBClient.getTableCreateScript(table), or UI 'Copy Table Create Script' on a DynamoDB table.

Common situations: User expects a CREATE TABLE equivalent to migrate/clone a table; schema-diff tooling requesting DDL for all tables.

Related errors


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