-- Mart: School location dimension — one row per URN, PostGIS-enabled
-- The geom column is populated by a post-hook or the geocode script.

select
    s.urn,
    s.address_line1,
    s.address_line2,
    s.town,
    s.county,
    s.postcode,
    s.local_authority_code,
    s.local_authority_name,
    s.parliamentary_constituency,
    s.urban_rural,
    s.easting,
    s.northing
from {{ ref('stg_gias_establishments') }} s
where s.status = 'Open'
  and s.postcode is not null
