Question

I'm trying to use a Scan operation on a DynamoDB table to match items with given 'tags'. The tags for an item are stored in a single set attribute. E.g.:

machine-1: tags = "windows", "iis", "64bit"
machine-2: tags = "windows", "fs"

Now, I have a support case open with Premium Support, but it's taking some amount of time. What I want to do is match machines where 'tags' contains the entry "windows" and "iis".

I can match a single one by using the CONTAINS mode, and specifying a single AttributeValue with a string value of "windows", for example.

However, CONTAINS does not support sets in a single AttributeValue, or multiple AttributeValues. It gives an error.

So I tried IN (something AWS premium support also suggested): however, whether I use a single AttributeValue (even just looking for "windows" again or multiple ones), I get zero results.

The documentation for IN is pretty poor. The operation is described in 4 uninformative words, in fact: "checks for exact matches".

While I wait for support possibly going on with a few more rounds of Q&A, is anyone reading this familiar with this kind of query with Scan? (If you could, please test what you're saying in your answer first: I think I have tried the obvious ones!)

For ref, Scan documentation: http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/API_Scan.html

Était-ce utile?

La solution

This from AWS premium support:

"Hello.

I got confirmation from Dynamo DB this is currently not supported. CONTAINS against a set can only be performed with a single value. "

Urgh. So now I will create a new attribute for each possible tag, with a 'True' or 'False' in each column, and filter my Scan on that.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top