Does anyone have a reference code on how to create a full export of a kv namespace? I am trying to w

Does anyone have a reference code on how to create a full export of a kv namespace? I am trying to write one myself but I am running into a lot of different issues, ranging from invalid cursors to max subrequest errors and/or inconsistent results. The kv I am testing with shows about 8.5k records in the cloudflare ui where I am already running into issues, the different production kv I will need to export will have around 144k entries so I am a bit worried about being able to export it successfully. My use-case is that we have a kv setup with redirects (key is the original url, target url is the value of the kv record), with data imported overtime from multiple files and we now sadly lack a "master file" with all our data. So to create this masterfile I want to export the current state of the kv into a csv so that the data can be analysed by business users in excel.
13 Replies
Mitya
Mitya2mo ago
Hi everyone, I'm new to KV and have been reading this guide. It talks about storing and serving static assets. My question is: what are the advantages of using KV for this rather than a public R2 bucket?
Hello, I’m Allie!
Well, this guide looks to be from back when Workers Sites were still a thing. You can use Assets now for free asset serving Another thing too is that per-key RPS can scale a bit better with KV as compared to R2 + built-in caching
thomasgauvin
thomasgauvin2mo ago
Like HardlyWorkin' said, there are a lot of better options than a public R2 bucket for serving static assets. Pages (https://developers.cloudflare.com/pages/) and Workers assets (https://developers.cloudflare.com/workers/static-assets/) provide hosting built for serving static sites. Using R2 and KV, while possible, would be sort of rebuilding what Pages & Workers assets do (can be valid in some cases!)
Hello, I’m Allie!
Actually, would be pretty cool to have Assets+, that could fallback to R2 instead of KV for large assets
Himakar
Himakar2mo ago
What is the maximum limit of kv namespace for enterprise edition?
fry69
fry692mo ago
These are the official limits -> https://developers.cloudflare.com/kv/platform/limits/ Otherwise talk to your enterprise support contact you should have when you are on an enterprise plan.
Mitya
Mitya2mo ago
Thanks, both.
kw
kw2mo ago
Error: KV PUT failed: 429 Too Many Requests what is the rate limit on put?
kw
kw2mo ago
another quick question, will put update remove the expiration if I don’t include it? kv.put(key, value, {expiration: x}) // Create the KV pairs kv.put(key,value2) // Update the value only In this case, is the expiration updated?
carlos-alberto
carlos-alberto2mo ago
Is anyone else seeing elevated error rates on KV puts over the last week or so?
No description
thomasgauvin
thomasgauvin2mo ago
Put won't remove the expiration if you don't include it, but it will overwrite it if you provide a new expiration Can you share you namespace id?
daniel_klungo
daniel_klungo2mo ago
I just experienced being rate-limited with the KV Namespaces Bulk Update API, with 2min 16s between the two API calls actually being rate-limited even though the keys are different triple checking if it's on my side (it usually is), but I've never had this happen with this app which have been running fine for several months
Want results from more Discord servers?
Add your server