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

WriteRequestBatch example assumes that all attributes are of StringSet type #31

Closed
konradkiss opened this issue Jan 15, 2013 · 5 comments
Labels
guidance Question that needs advice or information.

Comments

@konradkiss
Copy link

Hey guys. The current docs branch has a great example on using WriteRequestBatch to add an item. The problem is that the method used in the example - Item's fromArray- will assume each attribute to be a StringSet. This will end you with an exception when the type of ie. your hash key is not a StringSet (which is exactly the case in your PutItem example).

You should probably include a heads-up with this specific example and mention that the constructor of Item will take attributes in the (old) array format which has type definitions.

@jeremeamia
Copy link
Contributor

I'm not sure I if what you are saying is correct. Have you tested out what you are describing? Item::fromArray uses Attribute::factory to make intelligent guesses at what each attribute's type should be. Nothing in the example you are referring to should result in there being a StringSet. It's possible I might also be misunderstanding you.

@konradkiss
Copy link
Author

I did test it. Every attribute had ["SS" => value], which I found weird. I traced it to the Attribute::factory call before going with a new Item(...), so I don't have more info on that.
I'll be happy to dive in deeper tomorrow. It was a simple data array that works great with PutItem otherwise. Regardless, I should get back to you in a few hours about what else I can find.

@jeremeamia
Copy link
Contributor

OK, we'll look into that too. Thanks for letting us know.

@konradkiss
Copy link
Author

Jeremy, it looks like I'm not able to reproduce the problem I was having. I'm terribly sorry to have wasted your time. Everything works as designed and Attribute::factory assigns types as expected.

@jeremeamia
Copy link
Contributor

Hey, no worries! Thanks for looking back into it for us. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

3 participants