# View: master_discography_export

**View Name:** master_discography_export
**Table Source:** `Derived from: Prod.Nr_Contribution_Contributed_To_Nr_Sound_Recording, Prod.Nr_Contributor_Is_Main_Performer_Nr_Contribution, Prod.Nr_Contributor_Is_Session_Musician_Nr_Contribution, Prod.Performance_Nr_Contribution, Prod.Performance_Nr_Contributor + 3 more`
**File Path:** `views/master_discography_export.view.lkml`

## Overview

- **File Size:** 11721 bytes
- **Lines of Code:** 375
- **Dimensions:** 40
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `NR_ID` | string |
| `Primary_Artist_Displayed_As` | string |
| `Contributor_ID` | string |
| `Contributor_Name` | string |
| `Stage_Name` | string |
| `Contributor_Type` | string |
| `Roles` | string |
| `NR_Priority` | string |
| `Recording_Title` | string |
| `Recording_Version` | string |
| `ISRC` | string |
| `Audio_or_Video` | string |
| `Product_Name` | string |
| `Country_of_Mastering` | string |
| `Country_of_Contribution` | string |
| `Country_of_Recording` | string |
| `First_Year_of_Recording` | string |
| `Original_Label` | string |
| `Country_of_label_which_funded_recording` | string |
| `First_Year_of_Release` | string |
| `Catalogue_Number` | string |
| `Duration_in_seconds` | number |
| `Number_of_Primary_Performers` | string |
| `Vendor_ID` | string |
| `Contribution_ID` | string |
| `Sax_Rec_ID` | string |
| `Sax_Contributor_ID` | string |
| `Rec_Created_Date` | date |
| `Rec_Created_By` | string |
| `Rec_Modified_Date` | date |
| `Rec_Modified_By` | string |
| `Rec_Is_Deleted` | string |
| `Rec_Deleted_Date` | date |
| `Contr_Created_Date` | date |
| `Contr_Created_By` | string |
| `Contr_Modified_Date` | date |
| `Contr_Modified_By` | string |
| `Contr_Is_Deleted` | string |
| `Contr_Deleted_Date` | date |
| `Valid` | string |

## Derived Table

```sql
sql:
      SELECT
        sr.id NR_ID,
        sr.main_artist Primary_Artist_Displayed_As,
        nrbutor.id Contributor_ID,
        nrbutor.name Contributor_Name,
        nrbution.performance_name Stage_Name,
        Replace('Main Performer','nrbution.id','Main Performer') Contributor_Type,
        REGEXP_REPLACE(REGEXP_REPLACE(TO_CHAR(nrbution.instruments), '[""\\[|\\]]', ''),',',', ') Roles,
        sr.priority NR_Priority,
        sr.recording_title Recording_Title,
        sr.version Recording_Version,
        sr.isrc ISRC,
        sr.recording_type Audio_or_Video,
        sr.album_name Product_Name,
        sr.country_of_master Country_of_Mastering,
        nrbution.COUNTRY_OF_PERFORMANCE Country_of_Contribution,
        REGEXP_REPLACE(REGEXP_REPLACE(TO_CHAR(sr.COUNTRIES_OF_RECORDING), '[""\\[|\\]]', ''),',',', ') Country_of_Recording,
        sr.RECORDING_YEAR First_Year_of_Recording,
        sr.ORIGINAL_LABEL Original_Label,
        sr.COUNTRY_OF_LABEL Country_of_label_which_funded_recording,
        sr.first_release_year First_Year_of_Release,
        sr.catalog_number Catalogue_Number,
        sr.Duration Duration,
        sr.total_featured_performers Number_of_Primary_Performers,
        vc.vendor_id Vendor_ID,
        nrbution.id Contribution_ID,
        sr.external_id Sax_Rec_ID,
        v.contact_email Sax_Contributor_ID,
        sr.CREATED_AT Rec_Created_Date,
        sr.CREATED_BY Rec_Created_By,
        sr.LAST_MODIFIED_AT Rec_Modified_Date,
        sr.LAST_MODIFIED_BY Rec_Modified_By,
        sr.IS_DELETED Rec_Is_Deleted,
        sr.DELETED_AT Rec_Deleted_Date,
        nrbution.CREATED_AT Contr_Created_Date,
        nrbution.CREATED_BY Contr_Created_By,
        nrbution.LAST_MODIFIED_AT Contr_Modified_Date,
        nrbution.LAST_MODIFIED_BY Contr_Modified_By,
        nrbution.IS_DELETED Contr_Is_Deleted,
        nrbution.DELETED_AT Contr_Deleted_Date,
        nrbution.VALID Valid
        from FACTS.prod.performance_nr_contribution nrbution
        inner join facts.prod.nr_contributor_is_main_performer_nr_contribution ncf
        on nrbution.id = ncf.nr_contribution_id
        inner join FACTS.prod.performance_nr_contributor nrbutor
        on ncf.nr_contributor_id = nrbutor.id
        inner join FACTS.prod.nr_contribution_contributed_to_nr_sound_recording nsr
        on nrbution.id = nsr.nr_contribution_id
        inner join FACTS.prod.performance_nr_sound_recording sr
        on nsr.nr_sound_recording_id = sr.id
        inner join FACTS.prod.vendor_has_nr_contributor_nr_contributor vc
        inner join royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor v
        on vc.vendor_id = v.vendor_id
        on nrbutor.id = vc.nr_contributor_id

      UNION

      select
      sr.id NR_ID,
      sr.main_artist Primary_Artist_Displayed_As,
      nrbutor.id Contributor_Id,
      nrbutor.name Contributor_Name,
      nrbution.performance_name Stage_Name,
      Replace('Session Musician','nrbution.id','Session Musician') Contributor_Type,
      REGEXP_REPLACE(TO_CHAR(nrbution.instruments), '[""\\[|\\]]', '') Roles,
      sr.priority NR_Priority,
      sr.recording_title Recording_Title,
      sr.version Recording_Version,
      sr.isrc ISRC,
      sr.recording_type Audio_or_Video,
      sr.album_name Product_Name,
      sr.country_of_master Country_of_Mastering,
      nrbution.COUNTRY_OF_PERFORMANCE Country_of_Contribution,
      REGEXP_REPLACE(REGEXP_REPLACE(TO_CHAR(sr.COUNTRIES_OF_RECORDING), '[""\\[|\\]]', ''),',',', ') Country_of_Recording,
      sr.RECORDING_YEAR First_Year_of_Recording,
      sr.ORIGINAL_LABEL Original_Label,
      sr.COUNTRY_OF_LABEL Country_of_label_which_funded_recording,
      sr.first_release_year First_Year_of_Release,
      sr.catalog_number Catalogue_Number,
      sr.Duration Duration,
      sr.total_featured_performers Number_of_Primary_Performers,
      vc.vendor_id Vendor_ID,
      nrbution.id Contribution_ID,
      sr.external_id Sax_Rec_ID,
      v.contact_email Sax_Contributor_ID,
      sr.CREATED_AT Rec_Created_Date,
      sr.CREATED_BY Rec_Created_By,
      sr.LAST_MODIFIED_AT Rec_Modified_Date,
      sr.LAST_MODIFIED_BY Rec_Modified_By,
      sr.IS_DELETED Rec_Is_Deleted,
      sr.DELETED_AT Rec_Deleted_Date,
      nrbution.CREATED_AT Contr_Created_Date,
      nrbution.CREATED_BY Contr_Created_By,
      nrbution.LAST_MODIFIED_AT Contr_Modified_Date,
      nrbution.LAST_MODIFIED_BY Contr_Modified_By,
      nrbution.IS_DELETED Contr_Is_Deleted,
      nrbution.DELETED_AT Contr_Deleted_Date,
      nrbution.VALID Valid
      from FACTS.prod.performance.nr_contribution nrbution
      inner join facts.prod.nr_contributor_is_session_musician_nr_contribution ncf
      on nrbution.id = ncf.nr_contribution_id
      inner join FACTS.prod.performance_nr_contributor nrbutor
      on ncf.nr_contributor_id = nrbutor.id
      inner join FACTS.prod.nr_contribution_contributed_to_nr_sound_recording nsr
      on nrbution.id = nsr.nr_contribution_id
      inner join FACTS.prod.performance_nr_sound_recording sr
      on nsr.nr_sound_recording_id = sr.id
      inner join FACTS.prod.vendor_has_nr_contributor_nr_contributor vc
      on nrbutor.id = vc.nr_contributor_id
      inner join royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor v
      on vc.vendor_id = v.vendor_id

      UNION

      select
      sr.id NR_ID,
      sr.main_artist Primary_Artist_Displayed_As,
      nrbutor.id Contributor_Id,
      nrbutor.name Contributor_Name,
      nrbution.performance_name Stage_Name,
      Replace('Featuring Performer','nrbution.id','Featuring Performer') Contributor_Type,
      REGEXP_REPLACE(TO_CHAR(nrbution.instruments), '[""\\[|\\]]', '') Roles,
      sr.priority NR_Priority,
      sr.recording_title Recording_Title,
      sr.version Recording_Version,
      sr.isrc ISRC,
      sr.recording_type Audio_or_Video,
      sr.album_name Product_Name,
      sr.country_of_master Country_of_Mastering,
      nrbution.COUNTRY_OF_PERFORMANCE Country_of_Contribution,
      REGEXP_REPLACE(REGEXP_REPLACE(TO_CHAR(sr.COUNTRIES_OF_RECORDING), '[""\\[|\\]]', ''),',',', ') Country_of_Recording,
      sr.RECORDING_YEAR First_Year_of_Recording,
      sr.ORIGINAL_LABEL Original_Label,
      sr.COUNTRY_OF_LABEL Country_of_label_which_funded_recording,
      sr.first_release_year First_Year_of_Release,
      sr.catalog_number Catalogue_Number,
      sr.Duration Duration,
      sr.total_featured_performers Number_of_Primary_Performers,
      vc.vendor_id Vendor_ID,
      nrbution.id Contribution_ID,
      sr.external_id Sax_Rec_ID,
      v.contact_email Sax_Contributor_ID,
      sr.CREATED_AT Rec_Created_Date,
      sr.CREATED_BY Rec_Created_By,
      sr.LAST_MODIFIED_AT Rec_Modified_Date,
      sr.LAST_MODIFIED_BY Rec_Modified_By,
      sr.IS_DELETED Rec_Is_Deleted,
      sr.DELETED_AT Rec_Deleted_Date,
      nrbution.CREATED_AT Contr_Created_Date,
      nrbution.CREATED_BY Contr_Created_By,
      nrbution.LAST_MODIFIED_AT Contr_Modified_Date,
      nrbution.LAST_MODIFIED_BY Contr_Modified_By,
      nrbution.IS_DELETED Contr_Is_Deleted,
      nrbution.DELETED_AT Contr_Deleted_Date,
      nrbution.VALID Valid
      from FACTS.prod.performance.nr_contribution nrbution
      inner join facts.prod.nr_contributor_is_featuring_performer_nr_contribution ncf
      on nrbution.id = ncf.nr_contribution_id
      inner join FACTS.prod.performance_nr_contributor nrbutor
      on ncf.nr_contributor_id = nrbutor.id
      inner join FACTS.prod.nr_contribution_contributed_to_nr_sound_recording nsr
      on nrbution.id = nsr.nr_contribution_id
      inner join FACTS.prod.performance_nr_sound_recording sr
      on nsr.nr_sound_recording_id = sr.id
      inner join FACTS.prod.vendor_has_nr_contributor_nr_contributor vc
      on nrbutor.id = vc.nr_contributor_id
      inner join royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor v
      on vc.vendor_id = v.vendor_id;;
```

