如何删除 Dynamodb 中 table 的所有项目
How to delete all items the table in a Dynamodb
我尝试使用 AWS 中的 PartiQL 删除所有项目,但我收到了该消息
delete from myfile
An error occurred during the execution of the command.
ValidationException: Where clause does not contain a mandatory equality on all key attributes
看起来很简单...
ValidationException: Where clause does not contain a mandatory
equality on all key attributes
如果你看docs
语法是
DELETE FROM table
WHERE condition [RETURNING returnvalues]
还有
condition (Required)
The selection criteria for the item to be deleted; this condition must resolve to a single primary key value.
如果要删除 DDB 中的所有记录,请删除 table 并重新创建它。
当我用双引号 (") 查询过滤器时出现此错误,但它们是单引号 ('),即使字段本身是双引号。
这是错误的方法(我和你有同样的错误):
DELETE FROM "TABLE_A" WHERE "PK" = "<PK_A>" AND "SK" < "2022-03-27T14:10:00.000Z"
这是正确的方法(至少对我有用):
DELETE FROM "TABLE_A" WHERE "PK" = '<PK_A>' AND "SK" < '2022-03-27T14:10:00.000Z'
我尝试使用 AWS 中的 PartiQL 删除所有项目,但我收到了该消息
delete from myfile
An error occurred during the execution of the command.
ValidationException: Where clause does not contain a mandatory equality on all key attributes
看起来很简单...
ValidationException: Where clause does not contain a mandatory equality on all key attributes
如果你看docs
语法是
DELETE FROM table
WHERE condition [RETURNING returnvalues]
还有
condition (Required)
The selection criteria for the item to be deleted; this condition must resolve to a single primary key value.
如果要删除 DDB 中的所有记录,请删除 table 并重新创建它。
当我用双引号 (") 查询过滤器时出现此错误,但它们是单引号 ('),即使字段本身是双引号。
这是错误的方法(我和你有同样的错误):
DELETE FROM "TABLE_A" WHERE "PK" = "<PK_A>" AND "SK" < "2022-03-27T14:10:00.000Z"
这是正确的方法(至少对我有用):
DELETE FROM "TABLE_A" WHERE "PK" = '<PK_A>' AND "SK" < '2022-03-27T14:10:00.000Z'