-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Convenience methods for new DynamoDB data types #357
Comments
TL;DR maybe. This is a great question, and is one we've definitely asked ourselves. We have been trying to come up with some ideas about this, but it turns out to be a little difficult. The current What makes supporting something like the
OK, so doing something along the same lines as the
So, yeah. We'd like to provide something to help DynamoDB users, but we want it to:
I'm just not sure we've thought of something yet that provides all of these benefits. If you or anyone else has ideas/suggestions/opinions/etc., we'd be happy to hear them. |
I believe a literal JSON document would be the best option, as I think that's what most people that want to utilize maps and lists would be expecting to use. The lack of support for sets I don't see as particularly problematic as lists seem to cover all the use cases for sets unless looking at the raw API requests and responses. If the lack of binary support is an actual problem, one completely far out suggestion that I can think of is perhaps supporting BSON would be worth looking into, though I don't know what kind of can or worms that would open. |
Note: I'm removing one of @Sazpaimon's previous comments from this thread, since it's off topic, and will reply to it where it was cross-posted on #368. |
@Sazpaimon I've been toying with the idea (for both V2 and V3) of a |
This seems to be a good start as far as supporting raw JSON goes. My hope is that we can get to a point where you can input and output native PHP types and have it just automagically work, but I'm still not sure how we can get there given everything that's been stated |
Thank you @jeremeamia for inviting my input - I'm afraid I'm not sure what I can offer though. It looks like the best way to get the JSON into DynamoDB would be to pass a correctly formatted string though... I'm not sure how this would mess the current SDK though as I'm only taking baby-steps with DynamoDB at the minute. Sorry to of such little help but you did ask ;-) |
@Sazpaimon Hey, I updated my gist/idea with some more code and docblocks. Along with the |
Looks pretty good. If I had to many any suggestion as a workaround to support sets and binary types, would be to implement classes that basically provide the marshaller type hints those attributes. I don't know how practical such a thing would be, though. Now that I think about it, I think I just basically described the old Attribute class. Also, for unmarshalling binary types, I would unbase64 the data (if it isn't already) |
I don't think I'm going to worry about sets, but I might be able to use Guzzle's stream class to represent binary types. I'm going to play around with that after I write up some unit tests.
Good idea. I think V3 does it automatically, but I'll have to double check that for V2. |
Supporting sets would be useful if the user is going to do something like ADD/DELETE later on, as AFAIK, the list/map type does not support appending via the UpdateItem method, or if you want to ensure at the data layer that all your items are the same type and unique, so lists cannot replace sets 100% of the time. |
@Sazpaimon and @ando-masaki, I've put together a PR for my marshaler idea: #406. |
Resolved by 0a9c4fd. /cc @Sazpaimon Note: In Version 2 of the SDK, binary (B) and set (*S) types will not be supported. When this is added into Version 3 (that requires PHP 5.4+), I'll add support, because I will be able to use the |
Version 2.7.0 deprecated the
formatValue()
andformatAttribute()
methods, and the ItemIterator, Item, and Attribute classes (EDIT: added links to referenced classes) because they do not support the new data types. Will these methods be replaced with something else?I know this is a very new feature, but I do have some projects that can take advantage of this (EDIT: "this" is referring to the new document model support; see release notes) right away and I want to know if the SDK will add better support for these data types or if the recommended way of doing things from now on would be to manually construct and parse your items.
The text was updated successfully, but these errors were encountered: