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

Update using dashes #94

Open
ThomasAribart opened this issue Nov 23, 2020 · 4 comments · May be fixed by #553 or #405
Open

Update using dashes #94

ThomasAribart opened this issue Nov 23, 2020 · 4 comments · May be fixed by #553 or #405
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ThomasAribart
Copy link
Collaborator

ThomasAribart commented Nov 23, 2020

FooEntity.update({
  dictionary: {
    $set: {
      'field-with-dash': 'bar',
    },
  },
})

This update will fail as the update method will generate an ExpressionAttributeName containing { '#field-with-dash': 'field-with-dash' } and the dynamoDb client will throw an error Invalid ExpressionAttributeName key as it doesn't handle the #field-with-dash key... 😞

@jeremydaly jeremydaly added the bug Something isn't working label Nov 23, 2020
@jeremydaly
Copy link
Owner

Good catch. Looks like I'm just taking the attribute name and prefixing it with a #, but clearly that will cause issues. I should be able to switch it to an incrementing numerical index approach like I used for the projectionBuilder.

@jeremydaly jeremydaly self-assigned this Nov 23, 2020
@jeremydaly jeremydaly added this to the v0.3 milestone Nov 23, 2020
aslakhellesoy added a commit to SmartBear/dynamodb-toolbox that referenced this issue Dec 9, 2020
@thekiwi
Copy link

thekiwi commented Jan 11, 2021

I'm also hitting the same issue, but due to using spaces not dashes. For example, when running this:

FooEntity.update({
  dictionary: {
    $set: {
      'Hello World': 'bar',
    },
  },
})

...you get the error:

ValidationException: ExpressionAttributeNames contains invalid key: Syntax error; key: "#dictionary_Hello World"

PR #96 looks like a good option, but it requires extra logic and I sorta feel like this use-case should work out of the box.

@jeremydaly Did you have an implementation in mind for this, or were you intending to merge #96? I'm happy to assist, either creating an alternative PR or updating the existing one?

Brilliant library BTW! Really enjoying using it.

@Wingjam
Copy link

Wingjam commented Sep 2, 2021

I'm also facing the same issue when using uuid in set keys:

FooEntity.update({
  dictionary: {
    $set: {
      'b2333002-55be-47b8-8fbb-2e1ed19a5ab3': 'bar',
    },
  },
})

@ankitaabad
Copy link

I'm also facing the same issue. Any update on this ??

@jeremydaly jeremydaly removed this from the v0.3 milestone Jul 4, 2022
@jeremydaly jeremydaly removed their assignment Jul 5, 2022
@naorpeled naorpeled self-assigned this Jul 8, 2022
@naorpeled naorpeled added the help wanted Extra attention is needed label Nov 30, 2022
@naorpeled naorpeled removed their assignment Dec 2, 2022
@naorpeled naorpeled self-assigned this Dec 17, 2022
@naorpeled naorpeled removed the help wanted Extra attention is needed label Dec 17, 2022
@naorpeled naorpeled linked a pull request Dec 17, 2022 that will close this issue
@naorpeled naorpeled removed their assignment Apr 8, 2023
@naorpeled naorpeled added the good first issue Good for newcomers label Apr 8, 2023
@mitchheddles mitchheddles linked a pull request Jul 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
6 participants