Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Case insensitive query in DynamoDB

I want to scan/query the dynamo DB table. Dynamo DB is case sensitive. I want to use Hash/ Range keys sometimes as strings. Is there any way we can enable case insensitivity in dynamo DB level ? Or is there any other solutions exist? I am querying the Dynamo with the JAVA SDK

like image 929
Java Programmer Avatar asked Jan 21 '16 10:01

Java Programmer


People also ask

Is DynamoDB query case sensitive?

The following are the naming rules for DynamoDB: All names must be encoded using UTF-8, and are case-sensitive. Table names and index names must be between 3 and 255 characters long, and can contain only the following characters: a-z.

What is difference between scan and query in DynamoDB?

DynamoDB supports two different types of read operations, which are query and scan. A query is a lookup based on either the primary key or an index key. A scan is, as the name indicates, a read call that scans the entire table in order to find a particular result.

Does DynamoDB support conditional operations?

Yes, like all the other database management systems, DynamoDB also supports all the conditional operators, User can specify a condition that is satisfied for a put, update, or delete operation to work on an item.

Can you run SQL queries on DynamoDB?

You now can use a SQL-compatible query language to query, insert, update, and delete table data in Amazon DynamoDB. You now can use PartiQL (a SQL-compatible query language)—in addition to already-available DynamoDB operations—to query, insert, update, and delete table data in Amazon DynamoDB.


1 Answers

There are 2 possible ways I can think of

1) Solve at the application end by tweaking the schema

e.g Let say you have "Name" as hash key now whenever new users are added you add them after making their name in lower-case

John --> john

Doe --> doe

Remember to store both the value (name as hash for searching) and (displayName for displaying purpose)

Now before querying the database, you can convert you search to lower-case.

2) Use ElasticSearch: DyanmoDB table can be integrated with ElasticSearch which can perform different search operations on your table (refer link)

like image 179
Harshal Bulsara Avatar answered Sep 19 '22 12:09

Harshal Bulsara