DeleteTable

Description

The DeleteTable function deletes a table and all items present in the table.

For more information, see DeleteTable.

Category

History

ColdFusion (2020 release): Added in this version.

Syntax

serviceHandle.deleteTable(requestParameters)

Parameters

See DeleteTable.

Example

<cfscript> 
 cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamo = cloudService(cred, config) 
  tableName="YearlyProductCatalog" 
  // create a table 
  createTableStruct={ 
      "TableName": "#tableName#", 
      "KeySchema": [ 
          { 
              "AttributeName": "id","KeyType": "HASH" 
          }, 
          { 
              "AttributeName": "title","KeyType": "RANGE" 
          } 
      ], 
      "AttributeDefinitions": [ 
          { 
              "AttributeName": "id", 
              "AttributeType": "N" 
          }, 
          { 
              "AttributeName": "title", 
              "AttributeType": "S" 
          } 
      ], 
      "ProvisionedThroughput": { 
          "ReadCapacityUnits": 10, 
          "WriteCapacityUnits": 10 
      } 
  } 
 
  dynamo.createTable(createTableStruct) 
  sleep(20000) 
 
  // insert an item 
  putItemStruct = { 
      "TableName": "#tableName#", 
      "Item":{ 
          "id": {"N": 550}, 
          "title": {"S": "My Books Title"} 
      }, 
      "ReturnValues": "NONE" 
  } 
  dynamo.putItem(putItemStruct,{"hasType": true}) 
 
  // delete the table 
  deleteTableStruct={ 
    "TableName": "#tableName#" 
  } 
  try{ 
    deleteResponse=dynamo.deleteTable(deleteTableStruct) 
    writeOutput("Table deleted successfully") 
    writeDump(deleteResponse) 
  } 
  catch (any e){ 
    writeOutput("Unable to delete the table") 
    writeDump(e) 
  } 
</cfscript> 

Output

DeleteTable output
DeleteTable output

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online