Reputation: 11
Is ItemName in Amazon SimpleDB required as I don't seem to be able to delete it. Can I not create another attribute that can be used as a "Primary key".
Kind Regards
Upvotes: 1
Views: 287
Reputation: 22580
Yes, the item name is required, it's the sole unique identifier for an item and it's used in all item retrieval and update operations (except for the select
operation).
It's a bit hard for me to go into more detail not knowing why you don't want to use the item name but while you're required to provide an item name you're free to populate it with whatever value you want. So you could just dump a GUID there for example.
Since all attributes are automatically indexed you're free to use select
operations to retrieve items based on whatever attribute you want. It's a
select * from ExampleDomain where ExampleAttribute = 'foo' limit 1
And if you're only looking for the itemName (perhaps to use in a subsequent delete operation).
select itemName() from ExampleDomain where ExampleAttribute = 'foo' limit 1
See Using Select to Create Amazon SimpleDB Queries for more details about the select
operation.
I should note that using select
over GetAttributes
is a tad bit more expensive as it'll usually incur a higher BoxUsage than a simple GetAttributes
but for small workloads it won't matter. Measure with your own usage pattern.
Upvotes: 2