# View: spotify_artist_id_all_contributors

**View Name:** spotify_artist_id_all_contributors
**Table Source:** `Derived from: Art_Relations_Prod_Art_Relations.Artist_Info, Art_Relations_Prod_Art_Relations.Owner, Art_Relations_Prod_Art_Relations.Releases, Art_Relations_Prod_Art_Relations.Track_Artist, Dbt_Prod.Orch_App_Ar_Track_Track_Physical_Joined + 3 more`
**File Path:** `views/spotify_artist_id_all_contributors.view.lkml`

## Overview

- **File Size:** 2115 bytes
- **Lines of Code:** 65
- **Dimensions:** 4
- **Measures:** 0
- **Dimension Groups:** 0
- **Filters:** 0

## Dimensions

| Name | Type |
|------|------|
| `isrc` | string |
| `contributor_type` | string |
| `contributor_name` | string |
| `spotify_artist_id` | string |

## Derived Table

```sql
sql:
 with spotify_artist_id as (
select
name as artist_name,
spotify_id as spotify_artist_id,
vendor_id,
from FACTS.PROD.LABEL_PARTICIPANT where spotify_id is not null and (name is not null and name != '')
),

upc_tuid as (
SELECT
    orch_app_ar_track.id  AS tuid,
    orch_app_ar_releases.upc  AS upc,
    orch_app_ar_track.isrc  AS isrc,
    orch_app_ar_vendor.vendor_id  AS label_id
FROM orchard_app_reporting_v2.art_relations_prod_art_relations.owner  AS orch_app_ar_owner
INNER JOIN royalty_accounting_reporting.prod.vw_dim_abacus_ar_vendor  AS orch_app_ar_vendor ON lower(orch_app_ar_owner.owner_abbrivation) = lower(orch_app_ar_vendor.owner)
LEFT JOIN orchard_app_reporting_v2.art_relations_prod_art_relations.artist_info  AS orch_app_ar_artist_info ON orch_app_ar_vendor.vendor_id = orch_app_ar_artist_info.vendor_id
LEFT JOIN orchard_app_reporting_v2.art_relations_prod_art_relations.releases  AS orch_app_ar_releases ON orch_app_ar_artist_info.artist_id = orch_app_ar_releases.artist_id
INNER JOIN intelligence.dbt_prod.orch_app_ar_track_track_physical_joined  AS orch_app_ar_track ON orch_app_ar_track.release_id = orch_app_ar_releases.release_id
)

select distinct u.isrc,
ta.type as contributor_type,
ta.name as contributor_name,
s.spotify_artist_id
from ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.TRACK_ARTIST ta
left join upc_tuid u
    on ta.track_id = u.tuid
left join spotify_artist_id s
    on upper(ta.name) = upper(s.artist_name) and u.label_id = s.vendor_id
;;
```

