Skip to content

Instantly share code, notes, and snippets.

View richardcalahan's full-sized avatar
🎯
Focusing

Richard Calahan richardcalahan

🎯
Focusing
View GitHub Profile
#!/bin/bash
BUCKET="sgw-pd-t1"
PAGE_SIZE=10
# Search and replace this key
NEW_META_KEY="file-permissions"
NEW_META_VALUE="0777"
# can manually set in case of script failure, new token is output every `PAGE_SIZE` requests.
WITH
custom_values AS (
SELECT
location_id,
COALESCE(
JSONB_OBJECT_AGG(name, value) FILTER (WHERE name IS NOT NULL),
'{}'
) AS data
FROM custom_values
GROUP BY location_id