mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 01:12:56 +00:00
backup download_all_layers.py script
This commit is contained in:
20
download_all_layers.py
Normal file
20
download_all_layers.py
Normal file
@@ -0,0 +1,20 @@
|
||||
import requests
|
||||
|
||||
tenants = requests.get("http://localhost:15003/v1/tenant")
|
||||
tenants.raise_for_status()
|
||||
tenants = tenants.json()
|
||||
|
||||
for tenant in tenants:
|
||||
id = tenant["id"]
|
||||
timelines = requests.get(f"http://localhost:15003/v1/tenant/{id}/timeline")
|
||||
timelines.raise_for_status()
|
||||
for timeline in timelines.json():
|
||||
tid = timeline["tenant_id"]
|
||||
tlid = timeline["timeline_id"]
|
||||
layers = requests.get(f"http://localhost:15003/v1/tenant/{tid}/timeline/{tlid}/layer")
|
||||
layers.raise_for_status()
|
||||
layers = layers.json()
|
||||
for l in layers["historic_layers"]:
|
||||
if l["remote"] == False:
|
||||
requests.get(f"http://localhost:15003/v1/tenant/{tid}/timeline/{tlid}/layer/{l['layer_file_name']}")
|
||||
|
||||
Reference in New Issue
Block a user