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

problem in nested query #280

Open
BehroozBvk opened this issue Mar 29, 2024 · 1 comment
Open

problem in nested query #280

BehroozBvk opened this issue Mar 29, 2024 · 1 comment
Labels

Comments

@BehroozBvk
Copy link

BehroozBvk commented Mar 29, 2024

Hi guys, does anyone know why the nested query does not work?

my item in dynamodb:

[{
   
    "id": "6606744528803",
    "role": {
      "name": "user",
    }
    "created_at": "2024-03-29T07:56:53+00:00",
    "updated_at": "2024-03-29T07:56:53+00:00",
  }]

My Model : User.php

<?php

namespace App\Models;

use BaoPham\DynamoDb\DynamoDbModel as Model;

class User extends Model
{
    protected $guarded = [];
}

Use case:

User::query() ->where('role.name', 'user')->get();

Even so, I tried not work:

User::query() ->where('user_role.name', 'user')->get();

Error:

Aws \ DynamoDb\ Exception\ DynamoDbException

Error executing "Scan" on "http://dynamodb-local:8000"; AWS HTTP error: Client error: POST http://dynamodb-local:8000 resulted in a 400 Bad Request response: {"__type":"com.amazon.coral.validate#ValidationException","Message":"Invalid FilterExpression: Attribute name is a reser (truncated...) ValidationException (client): Invalid FilterExpression: Attribute name is a reserved keyword; reserved keyword: role - {"__type":"com.amazon.coral.validate#ValidationException","Message":"Invalid FilterExpression: Attribute name is a reserved keyword; reserved keyword: role"}

@thebatclaudio
Copy link
Contributor

You are using a reserved keyword (role): https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html

Maybe you can try to implement this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants