querying returns a different table name, GSI in dynamoDB
I am using dynamoid gem 3.6.0. I have a model and have GSI on one of its fields.When I query that table to fetch records of that field, it seems to use incorrect table name. Please help!!
Could you please provide an example to reproduce the issue?
it seems to use incorrect table name.
Could you please clarify how you did determine that the table name is wrong?
When I query to fetch some record, looking at the dynamodb in logs it looks for incorrect table and throws non existent table error
On Mon, 23 Nov, 2020, 11:18 pm Andrew Konchin, [email protected] wrote:
Could you please provide an example to reproduce the issue?
it seems to use incorrect table name.
Could you please clarify how you did determine that the table name is wrong?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Dynamoid/dynamoid/issues/474#issuecomment-732321205, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUIPZKFFSQ4IKPMWJLI5D3SRKN63ANCNFSM4T7UUZ5Q .
Could you provide some code to reproduce the issue? We need at least the model class (field and table declarations) and how to query a table to reproduce the error.
Hey, I run into the same issue, I was able to reproduce it with the code below:
require 'dynamoid'
class LoggableEvent
include ::Dynamoid::Document
table name: :loggable_events
field :event_object, :serialized
end
LoggableEvent.table
=> nil
LoggableEvent.table_name
=> "dynamoid_app_development_loggableevents"
# while the expected should be "dynamoid_app_development_loggable_events"
It's quite an expected behavior as far as table method is called twice:
# first time
table name: :loggable_events
# second time
LoggableEvent.table
# => nil
The second call overrides the table configuration and specified name loggable_events.
I guess this makes sense. That said, this might be a hint why in some edge cases there might be an incorrect table name used when querying DynamoDB.