Royal Civic Teal admin experience
Operational control surface
?
...
unknown
Model catalogue
/
Admin / dbt Studio / Models
stg_work_orders
Open in Studio
SJ
Stale
Compile
Test
Run
SQL
Compiled
Lineage
Docs
Preview
models/staging/stg_work_orders.sql
Copy
{{ config(materialized='view') }} with source as ( select * from {{ source('raw_airbyte', 'src_municipal_work_orders') }} ), renamed as ( select work_order_id, district_id::integer as district_id, category, status, cost_sar::numeric as cost_sar, opened_at::timestamp as opened_at, coalesce(closed_at::timestamp, null) as closed_at, _landed_at::timestamp as _landed_at, -- derived case when status = 'closed' then extract(epoch from (closed_at::timestamp - opened_at::timestamp)) / 3600 end as resolution_hours from source where work_order_id is not null ) select * from renamed
Console
Clear
-- stg_work_orders · open in dbt Studio