# View: Content_Owner_Master_Exporter

**View Name:** Content_Owner_Master_Exporter
**Table Source:** `Derived from: Prod.Nr_Ownership_Product_Has_Featured_Artist_Nr_Participant, Prod.Nr_Ownership_Product_Has_Primary_Artist_Nr_Participant, Prod.Nr_Ownership_Rules, Prod.Nr_Ownership_Track, Prod.Nr_Sound_Recording_Has_Featured_Artist_Nr_Participant + 3 more`
**File Path:** `views/Content_Owner_Master_Exporter.view.lkml`

## Overview

- **File Size:** 10461 bytes
- **Lines of Code:** 396
- **Dimensions:** 52
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `VENDOR_ID` | string |
| `product_primary_artist` | string |
| `Product_featured_artist` | string |
| `product_display_artist_name` | string |
| `product_name` | string |
| `imprint` | string |
| `P_LINE_LABEL` | string |
| `P_LINE_YEAR` | number |
| `content_type` | string |
| `product_type` | string |
| `product_format` | string |
| `product_sub_type` | string |
| `product_version` | string |
| `UPC` | string |
| `product_code` | string |
| `sales_start_date` | string |
| `disc_number` | string |
| `track_number` | string |
| `Primary_Artist` | string |
| `featured_artist` | string |
| `recording_display_artist_name` | string |
| `display_composer` | string |
| `song_name` | string |
| `song_version` | string |
| `ISRC` | string |
| `associated_audio_isrc` | string |
| `Duration` | number |
| `explicit` | string |
| `genre` | string |
| `audio_language` | string |
| `country_of_label` | string |
| `country_of_recording` | string |
| `first_recording_year` | string |
| `first_release_year` | string |
| `start_date` | string |
| `end_date` | string |
| `percentage` | number |
| `collect` | string |
| `carveout` | string |
| `notes` | string |
| `Sax_Rec_ID` | string |
| `Contributor_Legal_Name` | string |
| `Contributor_Type` | string |
| `Contributor_Role` | string |
| `Sound_Recording_ID` | string |
| `NR_Track_ID` | string |
| `NR_Track_Title` | string |
| `track_version` | string |
| `reference` | string |
| `nr_product_id` | string |
| `vendor_name` | string |
| `vendor_owner` | string |

## SQL Comments

- -----Product-------
- -----Sound Recording-----------
- ------Ownership-----------
- -----Contributor---------

## Derived Table

```sql
sql:
      select
VENDOR_ID,
content.product_primary_artist,
content.Product_featured_artist
content.product_display_artist_name,
content.product_name,
content.imprint,
content.P_LINE_LABEL,
content.P_LINE_YEAR,
content.content_type,
content.product_type,
content.product_format,
content.product_sub_type,
content.product_version,
content.UPC,
content.product_code,
content.sales_start_date,
content.disc_number,
content.track_number,
content.Primary_Artist,
content.featured_artist,
content.recording_display_artist_name,
content.display_composer,
content.song_name,
content.song_version,
content.ISRC,
content.associated_audio_isrc,
content.Duration,
content.explicit,
content.genre,
content.audio_language,
content.country_of_label,
content.country_of_recording,
content.first_recording_year,
content.first_release_year,
content.start_date,
content.end_date,
content.percentage,
content.collect,
content.carveout,
content.notes,
listagg(content.contributor_name,' | ') Contributor_Legal_Name,
listagg(content.contribution_type,' | ') Contributor_Type,
listagg(content.instruments, ' | ' )Contributor_Role,
content.Sound_Recording_ID,
content.NR_Track_ID,
content.NR_Track_Title,
content.track_version,
content.reference,
content.nr_product_id,
content.vendor_name,
content.vendor_owner

from
(select
nrot.SUBMITTED_BY_VENDOR_ID vendor_id,
-------Product-------
(select listagg(p.name,' | ') from FACTS.PROD.NR_OWNERSHIP_PRODUCT_HAS_PRIMARY_ARTIST_NR_PARTICIPANT poa left join FACTS.PROD.ownership_nr_participant p on poa.NR_PARTICIPANT_id = p.id where poa.NR_product_ID = nrpr.id) Product_Primary_Artist,
(select listagg (p.name,' | ') from FACTS.PROD.NR_OWNERSHIP_PRODUCT_HAS_featured_ARTIST_NR_PARTICIPANT pof left join  FACTS.PROD.ownership_nr_participant p on pof.NR_PARTICIPANT_id = p.id where pof.NR_product_ID = nrpr.id) Product_featured_artist,
nrpr.display_artist_name product_display_artist_name,
nrpr.name product_name,
nrpr.imprint,
nrpr.P_LINE_LABEL,
nrpr.P_LINE_YEAR,
nrpr.content_type,
nrot.recording_type product_type,
nrpr.format product_format,
nrpr.sub_type product_sub_type,
nrpr.version product_version,
nrpr.UPC,
nrpr.code product_code,
nrpr.sales_start_date,
nrot.disc_number,
nrot.track_number,
-------Sound Recording-----------
(select listagg(p.name,' | ') from FACTS.PROD.NR_SOUND_RECORDING_HAS_primary_ARTIST_NR_PARTICIPANT pa left join FACTS.PROD.ownership_nr_participant p on pa.NR_PARTICIPANT_id = p.id where pa.NR_SOUND_RECORDING_ID = osr.id) Primary_Artist,
(select listagg (p.name,' | ') from FACTS.PROD.NR_SOUND_RECORDING_HAS_featured_ARTIST_NR_PARTICIPANT fa left join  FACTS.PROD.ownership_nr_participant p on fa.NR_PARTICIPANT_id = p.id where fa.NR_SOUND_RECORDING_ID = osr.id) featured_artist,
osr.display_artist_name recording_display_artist_name,
osr.display_composer,
osr.recording_title song_name,
osr.version song_version,
osr.ISRC ,
nrot.associated_audio_isrc,
osr.Duration ,
osr.explicit ,
osr.genre ,
osr.audio_language ,
listagg(distinct(cyf.abbrivation),', ') within group (order by 1) Country_of_Label,
listagg(distinct(cy.abbrivation),', ') within group (order by 1) Country_of_Recording,
osr.first_recording_year,
osr.first_release_year,
--------Ownership-----------
nror.start_date,
nror.end_date,
nror.percentage,
(select listagg(distinct(nror.territory),', ') from FACTS.PROD.NR_OWNERSHIP_RULES nror where osr.id = nror.NR_SOUND_RECORDING_ID and nror.ownership_rule_type  = 'COLLECT') as COLLECT,
(select listagg(distinct(nror.territory),', ') from FACTS.PROD.NR_OWNERSHIP_RULES nror where osr.id = nror.NR_SOUND_RECORDING_ID and nror.ownership_rule_type  = 'CARVEOUT') as CARVEOUT,
nrot.notes,
-------Contributor---------
oc.name contributor_name,
ct.contribution_type ,
listagg(distinct(inst.value),', ') within group (order by 1) instruments,
osr.id Sound_Recording_ID,
nrot.id NR_Track_ID,
nrot.title NR_Track_Title,
nrot.version track_version,
nrot.reference,
nrpr.id NR_Product_ID,
v.name Vendor_Name,
v.owner Vendor_Owner

from FACTS.PROD.NR_OWNERSHIP_TRACK nrot
join FACTS.PROD.OWNERSHIP_NR_SOUND_RECORDING osr on nrot.isrc = osr.isrc
left join FACTS.PROD.NR_OWNERSHIP_RULES nror on osr.id = nror.nr_sound_recording_id
join FACTS.PROD.NR_PRODUCT_INCLUDES_NR_TRACK nrprtr on nrot.id = nrprtr.nr_track_id
join FACTS.PROD.NR_OWNERSHIP_PRODUCT nrpr on nrprtr.nr_product_id = nrpr.id
join table(flatten (input => osr.countries_of_funding, outer => TRUE)) cf
join orchard_app_reporting_v2.art_relations_prod_art_relations.country cyf on cyf.country_code=cf.value
join table(flatten (input => osr.countries_of_recording, outer => TRUE)) cr
join orchard_app_reporting_v2.art_relations_prod_art_relations.country cy on cy.country_code=cr.value
JOIN royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor v ON nrot.SUBMITTED_BY_VENDOR_ID = v.vendor_id
left join FACTS.PROD.NR_CONTRIBUTION_CONTRIBUTED_TO_NR_SOUND_RECORDING csr on osr.id = csr.nr_sound_recording_id
join FACTS.PROD.OWNERSHIP_NR_CONTRIBUTION c  on csr.nr_contribution_id = c.id
join FACTS.PROD.NR_CONTRIBUTION_TYPE ct on c.id = ct.nr_contribution_id
join FACTS.PROD.OWNERSHIP_NR_CONTRIBUTOR oc on ct.nr_contributor_id = oc.id
join table(flatten (input => c.instruments, outer => TRUE)) inst
where nror.is_deleted not like true
group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,33,34,35,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51) content

group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,44,45,46,47,48,49,50,51
;;
```

