I need to join two tables with aws dynamodb. Currently I am querying the
one just fine, but I need to bring in this other table, but I’m having a
heck of a time finding a simple example for dynamodb with rails.
client = Aws::DynamoDB::Client.new
response = client.scan(table_name: 'db_current')
@items = response.items
db_current
{“machine_id”=>“pc-123435”, “type_id”=>“t-56778”}
db_type
{“description”=>“Dell 5 Dev Computer”, “Name”=>“Dell”,
“type_id”=>“t-56778”}
I thought I might have to make two:
client = Aws::DynamoDB::Client.new
db_c = client.scan(table_name: 'db_current')
@c_items = db_c.items
client = Aws::DynamoDB::Client.new
db_t = client.scan(table_name: 'db_type')
@t_items = db_c.joins(db_t['type_id']) <=== then merge them
here.
But sadly no luck.
I’m looking for suggestions. I’d prefer to keep it simple to really
understand (I don’t want to pull in ActiveRecord or things like that
yet).