accesspatterns.dev

PutItem replaces

PutItem writes a whole item and overwrites any item with the same key.

Why

PutItem writes an entire item. If the key is new, you get a new item. If an item with that key already exists, PutItem replaces it wholesale: it does not merge.

Add a track, then overwrite track 001 with a version that drops the seconds attribute. Look at the row: the old attribute did not survive. That is the footgun and the feature.

PutItem is write-or-replace by key. To change part of an item without losing the rest, use UpdateItem.

Playlists

These rows are real and already here. Running an operation against them downloads a DynamoDB-compatible engine, about 850 KB, and executes it in this tab.

Try an example

A new key, so a new item appears in the Chill playlist.

pk(pk)
sk(sk)
name
owner
title
seconds
PLAYLIST#chill
METAS
ChillS
adaS
PLAYLIST#chill
TRACK#001S
WeightlessS
485N
PLAYLIST#chill
TRACK#002S
An EndingS
252N
PLAYLIST#chill
TRACK#003S
Avril 14thS
120N
PLAYLIST#focus
METAS
FocusS
linusS
PLAYLIST#focus
TRACK#001S
SubstrataS
360N
PLAYLIST#focus
TRACK#002S
Music for 18 MusiciansS
3360N
PLAYLIST#focus
TRACK#003S
Spiegel im SpiegelS
540N
PLAYLIST#focus
TRACK#004S
MetamorphosisS
600N
PLAYLIST#focus
TRACK#005S
GlassworksS
380N
PLAYLIST#energy
METAS
EnergyS
graceS
PLAYLIST#energy
TRACK#001S
Lose YourselfS
326N
PLAYLIST#energy
TRACK#002S
BangarangS
215N
PLAYLIST#energy
TRACK#003S
TitaniumS
245N
PLAYLIST#energy
TRACK#004S
LevelsS
340N
PLAYLIST#energy
TRACK#005S
One More TimeS
320N
PLAYLIST#sleep
METAS
SleepS
adaS
PLAYLIST#sleep
TRACK#001S
SleepS
480N
PLAYLIST#sleep
TRACK#002S
We Move LightlyS
300N
PLAYLIST#sleep
TRACK#003S
SamanS
510N
PLAYLIST#sleep
TRACK#004S
Nuvole BiancheS
360N
PLAYLIST#commute
METAS
CommuteS
samS
PLAYLIST#commute
TRACK#001S
RoygbivS
180N
PLAYLIST#commute
TRACK#002S
TeardropS
330N
PLAYLIST#commute
TRACK#003S
Midnight CityS
244N
PLAYLIST#commute
TRACK#004S
Open Eye SignalS
460N

Run an operation to see the raw engine response.

table Playlistskeys pk / skitems 26