stefanbund / 311

Interactive Web Development
33 stars 46 forks source link

useing a none Partition Key to querying dynamodb #22

Closed PatrickMinett closed 7 years ago

PatrickMinett commented 7 years ago

I started getting an error when I tried to use the none Partition Key to specific the column. I was wondering is it possible to querying are database using something other then a partition key. ( I ended up changing my table to make it work).

stefanbund commented 7 years ago

It looks like you dictated this message using voice. What do you mean by none partition key?

From Stefan Bund

On Feb 5, 2017, at 6:21 PM, PatrickMinett notifications@github.com wrote:

I started getting an error when I tried to use the none Partition Key to specific the column. I was wondering is it possible to querying are database using something other then a partition key. ( I ended up changing my table to make it work).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

PatrickMinett commented 7 years ago

I will try to clarify, In dynamodb we are given two types of keys, the Partition key and the sort key those along with attributes we define will basically dictate what type of data that is going to have in our table ( ie in my case I have the table: Armory, I have WeaponId(partition key) and type(sort key) and other attributes like FiringRate, Model, ammunitionType.

In are code we are given KeyCoditionExpression which if I am understanding correctly determines which attribute we are going to apply are search criteria too or so I though. In my attempts to get my database working, I found that I could only use my Partition key (ie WeaponId) to quarry my database any attempts to say refer to the attribute ammunitionType or any other None partition key would result in error code saying I needed to use the partitioned.

my question is what if I wanted to let my user Search by a different attribute say I wanted to be able to let my user search weapons by ammunitionType? Am I stuck having to plan ahead or is there a way I can get my code to quarry another attribute that is not Partition key ( WeaponId)

hope that helps, thanks.

stefanbund commented 7 years ago

Let's visit in class and look over the document client API

From Stefan Bund

On Feb 6, 2017, at 1:13 AM, PatrickMinett notifications@github.com wrote:

I will try to clarify, In dynamodb we are given two types of keys, the Partition key and the sort key those along with attributes we define will basically dictate what type of data that is going to have in our table ( ie in my case I have the table: Armory, I have WeaponId(partition key) and type(sort key) and other attributes like FiringRate, Model, ammunitionType.

In are code we are given KeyCoditionExpression which if I am understanding correctly determines which attribute we are going to apply are search criteria too or so I though. In my attempts to get my database working, I found that I could only use my Partition key (ie WeaponId) to quarry my database any attempts to say refer to the attribute ammunitionType or any other None partition key would result in error code saying I needed to use the partitioned.

my question is what if I wanted to let my user Search by a different attribute say I wanted to be able to let my user search weapons by ammunitionType? Am I stuck having to plan ahead or is there a way I can get my code to quarry another attribute that is not Partition key ( WeaponId)

hope that helps, thanks.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.