{"record":{"id":"c564634f52bdc43c","repo":"beekeeper-studio/beekeeper-studio","slug":"dynamodb-does-not-expose-create-table-sql","errorCode":null,"errorMessage":"DynamoDB does not expose CREATE TABLE SQL","messagePattern":"DynamoDB does not expose CREATE TABLE SQL","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"apps/studio/src-commercial/backend/lib/db/clients/dynamodb.ts","lineNumber":875,"sourceCode":"      }));\n    }\n  }\n\n  // -------------------- unsupported operations ---------------------\n  getBuilder(table: string, schema?: string): ChangeBuilderBase {\n    return new DynamoDBChangeBuilder(table, schema);\n  }\n\n  async createDatabase(): Promise<string> {\n    throw new Error('DynamoDB does not support creating databases');\n  }\n\n  async createDatabaseSQL(): Promise<string> {\n    throw new Error('DynamoDB does not support generating SQL');\n  }\n\n  async getTableCreateScript(): Promise<string> {\n    throw new Error('DynamoDB does not expose CREATE TABLE SQL');\n  }\n\n  async getViewCreateScript(): Promise<string[]> {\n    throw new Error('DynamoDB does not support views');\n  }\n\n  async getMaterializedViewCreateScript(): Promise<string[]> {\n    throw new Error('DynamoDB does not support materialized views');\n  }\n\n  async getRoutineCreateScript(): Promise<string[]> {\n    throw new Error('DynamoDB does not support routines');\n  }\n\n  async setElementName(): Promise<void> {\n    throw new Error('DynamoDB does not support renaming tables');\n  }\n","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/beekeeper-studio/beekeeper-studio/blob/4e3e03e3223b2b71a1af8926d455f533b80af837/apps/studio/src-commercial/backend/lib/db/clients/dynamodb.ts#L857-L893","documentation":"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.","triggerScenarios":"Calling DynamoDBClient.getTableCreateScript(table), or UI 'Copy Table Create Script' on a DynamoDB table.","commonSituations":"User expects a CREATE TABLE equivalent to migrate/clone a table; schema-diff tooling requesting DDL for all tables.","solutions":["Use the table's description (key schema, GSIs/LSIs, billing mode) to reconstruct an aws dynamodb create-table CLI/SDK call instead","Hide or disable 'Copy create script' for DynamoDB tables","Catch the error and offer table details JSON export as an alternative"],"exampleFix":"// before\nconst ddl = await client.getTableCreateScript('users');\n// after\nconst ddl = client.connectionType === 'dynamodb'\n  ? buildCreateTableCli(await client.tableDescription('users'))\n  : await client.getTableCreateScript('users');","handlingStrategy":"try-catch","validationCode":"if (isDynamoDBClient(client)) {\n  const desc = await client.tableDetails(table);\n  return toCreateTableCliScript(desc);\n}","typeGuard":"const isDynamoDB = (c: unknown): c is DynamoDBClient => c instanceof DynamoDBClient;","tryCatchPattern":"try {\n  return await client.getTableCreateScript(table);\n} catch (e) {\n  if (e.message.includes('does not expose CREATE TABLE')) {\n    return exportTableSchemaAsJson(table);\n  }\n  throw e;\n}","preventionTips":["Offer DynamoDB users an aws dynamodb create-table reconstruction from DescribeTable instead","Disable 'copy create script' menu items for DynamoDB tables","Document that DynamoDB DDL is API-based, not SQL"],"tags":["dynamodb","nosql","unsupported-operation","ddl"],"backgroundTag":"unsupported-dynamodb-operation","analyzedSha":"4e3e03e3223b2b71a1af8926d455f533b80af837","analyzedAt":"2026-08-31T23:21:23.379Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}