0

I'm trying to find all entries in a table with an attribute (non-index) "IDs" for arrays that are empty using the DynamoDB online interface.

The array generally contain strings and if I scan the table with a filter of "ID" String Contains "value" it will return all the entries that contain that value in the array. However I'm trying to find all the arrays that contain no values.

I've tried using the Not Contains filter, but that doesn't seem to work as I need to find arrays that don't contain anything not just one particular value.

An example of an entry I'm trying to find:

{
  "accountname": "test_account",
  "username": "test_user",
  "IDs": []
}

and an example of an entry I would be trying to exclude:


    {
      "accountname": "test_account",
      "username": "test_user",
      "IDs": ["test_id1"]
    }

1
  • I don't know what are you trying to achieve here but scans can be costly and slow if you are using it as SELECT * FROM WHERE. If you want to repeatedly query such records I suggest to think about sparse index - set selected property to records which have empty IDs e.g. empty_ids = test_account. You set empty_ids as hash key on your index. It will result in index which contains only records with empty IDs and you can query them per account. Commented Jul 29, 2019 at 21:15

1 Answer 1

1

I have my array stored as list and querying agains NULL works for me.

Here is how the data is stored

dynamodb data

and here is how fetching it works

query dynamodb with empty array

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.