Closed wotbrew closed 8 years ago
Hi Dan, thanks for the report.
You're right about the cause. When I wrote attr-multi-vs
way-back-when, there wasn't a native list type. Added support for the list type later and hadn't thought about the interplay here.
I don't actually use DDB/Faraday myself, so would appreciate input from folks who do. One idea off the top of my head: we could support a ^:literal
metadata flag on vectors given to batch-write-item
to skip the usual product behaviour?
Or the default could go the other way (i.e. we could offer an ^:each
metadata flag) and default to literal vectors otherwise.
Thoughts/PRs welcome.
Strawman proposal (feel free to shoot this down :smile:):
Rather than use metadata flags to dictate the behaviour here, would it be better at this point to simply remove the list shortcut and force updates to be provided 'longhand'. Obviously the cartesian product behaviour would be lost, but it's possible to achieve this outside Faraday of course.
This would be a major breaking change and worth a major version change IMO (breakver notwithstanding).
Strawman proposal (feel free to shoot this down :smile:):
No, no - this is the kind of feedback I'm looking for (thanks Joe). Again, I haven't used any of this code so have no opinion myself.
it be better at this point to simply remove the list shortcut and force updates to be provided 'longhand'
I'd be open to that. Any objections?
This would be a major breaking change and worth a major version change IMO (breakver notwithstanding).
A v2 would seem appropriate to me.
I would much rather 'opt-in' to the product behaviour, and agree it should be ideally an explicit action and doesn't really need to be part of faraday.
Agree with the idea of pushing this out of faraday. A nice to have that's no longer so nice :)
Okay, on track to remove this in a future breaking v2 release.
Have introduced a non-breaking opt-out flag in the meantime (untested):
https://github.com/ptaoussanis/faraday/commit/d2daff3b742faf5bc4884e79390fb5c1c01f07ec - just supply {attr-multi-vs? false}
to batch-write-item
or batch-get-item
.
Changing the attr-multi-vs?
default to false
in the latest v1.9.0 SNAPSHOT.
If we have top level lists in our items to insert e.g
it seems the request for item with :id 0 will be duplicated as
I believe you take a product when list values are involved to support deletes as documented in the doc string for
batch-write-item
:Obviously this causes problems when the intention is to put a list into dynamo.
Hopefully that is clear, comment if it isn't!
Regards
Dan