Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query for attributes containing '-' fails #3

Closed
martin-macak opened this issue May 8, 2022 · 3 comments
Closed

Query for attributes containing '-' fails #3

martin-macak opened this issue May 8, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@martin-macak
Copy link

martin-macak commented May 8, 2022

Description

When query contains attribute with - in name then it fails with following error:

ValidationException
Invalid KeyConditionExpression: Syntax error; token: "-", near: "GI-1"

This is caused by not masking ExpressionAttributeNames with valid values. This is btw. the same error that competing product Dynobase has. This is killer, because it makes plugin unusable for most of tables that follow this naming convention. It's extremely inconvenient as AWS encourages developers to name their entities and attributes in DNS compliant way, which contains - character.

Steps to reproduce

  • Create table with GI named GI-1-PK
  • Scan for table in DynamoDB plugin
  • Fill in query GI-1-PK = "A"

Suggestion for fix

Use ExpressionAttributeNames to rename all attributes to safe names

@martin-macak
Copy link
Author

martin-macak commented May 8, 2022

Seems like query is constructed like

Query
{
  "Limit": 50,
  "KeyConditionExpression": "GI-1-PK = :partitionKeyVal",
  "ExpressionAttributeValues": {
    ":partitionKeyVal": {
      "S": "A"
    }
  },
  "IndexName": "GI-1",
  "TableName": "Table-dev-v1"
}

So it should be super easy to add ExpressionAttributeNames

@AntonShuvaev
Copy link
Owner

Thanks for reporting the issue. I will fix it as soon as possible.

@AntonShuvaev AntonShuvaev added the bug Something isn't working label May 8, 2022
@AntonShuvaev
Copy link
Owner

Fixed in 2022.1.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants