Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use regex in a DynamoDB query?

Tags:

I want to use regex when I query a table. I tried to use it under KeyConditionExpression, but it isn't valid. Is there any way to do it with DynamoDB?

For example, my primary key is a string, and I want to get all the items that start with an A. The KeyConditionExpression expression would look like "someKey = /^A/"

like image 916
Yonatan Avatar asked May 06 '16 18:05

Yonatan


People also ask

Is DynamoDB good for querying?

Querying is a very powerful operation in DynamoDB. It allows you to select multiple Items that have the same partition ("HASH") key but different sort ("RANGE") keys.

What does the Query operation in Amazon DynamoDB allow you to do?

The Query operation allows you to limit the number of items that it reads. To do this, set the Limit parameter to the maximum number of items that you want. For example, suppose that you Query a table, with a Limit value of 6 , and without a filter expression.

Which is faster Scan or Query in DynamoDB?

More complex queries on DynamoDB data are occasionally required. Instead of scanning for such queries, it is usually preferable to create a GSI (global secondary index). Out of interest, I ran an experiment to confirm that Scan operation is indeed slower than Query operation.

Does DynamoDB support complex queries?

DynamoDB does support the complex condition on FilterExpression . Perfectly fine.


1 Answers

No. DynamoDB does not support regex.

The closest thing is CONTAINS and NOT_CONTAINS.

See documentation.

like image 195
Bohemian Avatar answered Sep 23 '22 03:09

Bohemian