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

filter expression with or? #640

Open
rhuang opened this issue Apr 5, 2023 · 2 comments
Open

filter expression with or? #640

rhuang opened this issue Apr 5, 2023 · 2 comments

Comments

@rhuang
Copy link

rhuang commented Apr 5, 2023

I want to query against an index but also apply a filter expression with contains and or. Is this supported in Dynamoid? I don't think I can find any examples within the code.

This is what I want to do:

query_params = {
  table_name: 'table_name',
  index_name: 'some-index,
  select: 'ALL_ATTRIBUTES',
  expression_attribute_values: {
    ':name_search1' => 'johnny',
    ':name_search2' => 'jane',
    ':user_id' => '1234567890'
  },
  key_condition_expression: 'user_id = :user_id',
  filter_expression: 'contains(name_search, :name_search1) or contains(name_search, :name_search2)',
  scan_index_forward: false
}

results = Aws::DynamoDB::Client.new(region: 'us-east-1').query(query_params)
@andrykonchin
Copy link
Member

andrykonchin commented Apr 5, 2023

Dynamoid still uses deprecated QueryFilter and KeyConditions attributes for Query operation and doesn't support more flexible FilterExpression and KeyConditionExpression yet.

It's planned to release it in the next minor versions.

@rhuang
Copy link
Author

rhuang commented Apr 5, 2023

Thank you for the quick response. Will watch for the next few releases.

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

No branches or pull requests

2 participants