-- @param {String} $1:regionCode
SELECT
  d.id, d.name, d.operator, d.capacity_mw, d.status, d.year_opened,
  ST_AsGeoJSON(d.location)::TEXT as location_geojson
FROM datacenters d
JOIN grid_regions r ON d.region_id = r.id
WHERE r.code = $1
ORDER BY d.capacity_mw DESC
