view: Vendor_Emails {
  derived_table: {
    sql:
    select
i.email,
i.first_name,
i.last_name,
v.vendor_id,
v.status,
c.name
from facts.prod.identity i
join facts.prod.has_profile p on p.identity_id = i.id
join facts.prod.profile_has_access_to_vendor vp on vp.profile_uuid = p.profile_uuid
join facts.prod.company_brand_has_label_vendor cp on cp.vendor_id::String = vp.vendor_id::String
join royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor v on v.vendor_id = vp.vendor_id
join facts.prod.company_brand c on c.uuid = cp.company_brand_uuid
where c.name = 'knr'
and v.status = 'signed'
and i.active = 'Y'
and i.email not like '%theorchard.com%'
and i.email not like '%kollectivenr.com%'
and i.email not like '%awal.com%'
and i.email not like '%sonymusic-pde%'
    ;;
  }

  dimension: email {
    type:  string
    sql: ${TABLE}.email ;;
  }

  dimension: first_name {
    type:  string
    sql: ${TABLE}.first_name ;;
  }

  dimension: last_name {
    type:  string
    sql: ${TABLE}.last_name ;;
  }

  dimension: vendor_id {
    type:  string
    sql: ${TABLE}.vendor_id ;;
  }

  dimension: status {
    type:  string
    sql: ${TABLE}.status ;;
  }

  dimension: name {
    type:  string
    sql: ${TABLE}.name ;;
  }

}