label: "Basic Models" connection: "accounting_aggregates" include: "*.view.lkml" explore: vendor_snowflake { access_filter: { field: vendor_snowflake.vendor_id user_attribute: label_id } ## From Joey: ## "booked_vendor_contract_snapshot filters on Label ID using column vendor_id" label: "Metadata" view_label: "Vendor" hidden: yes symmetric_aggregates: yes ## Created view owner_snowflake (copied from internal instance, just changed table name) join: owner_snowflake { view_label: "Owner" sql_on: ${vendor_snowflake.owner} = ${owner_snowflake.owner_abbrivation} ;; relationship: many_to_one } ## Created view artist_info_snowflake (copied from internal instance, just changed table name) join: artist_info_snowflake { view_label: "Artist" sql_on: ${vendor_snowflake.vendor_id} = ${artist_info_snowflake.vendor_id} ;; relationship: one_to_many } join: releases_snowflake { view_label: "Release" sql_on: ${artist_info_snowflake.artist_id} = ${releases_snowflake.artist_id} ;; relationship: one_to_many } ## Added the "from" parameter join: track_snowflake { from: releases_snowflake view_label: "Track" sql_on: ${track_snowflake.release_id} = ${releases_snowflake.release_id} ;; relationship: one_to_many } ## Created view subaccount_snowflake (copied from internal instance, just changed table name) join: subaccount_snowflake { view_label: "Subaccount" sql_on: ${releases_snowflake.subaccount_id} = ${subaccount_snowflake.subaccount_id} ;; relationship: many_to_one } join: product_type_snowflake { view_label: "Product Type" sql_on: ${releases_snowflake.product_type_id}= ${product_type_snowflake.id} ;; relationship: one_to_one } ## Replaced view name vendor_contract_snowflake_original with name vendor_contract_snowflake join: vendor_contract_all { from: vendor_contract_snowflake view_label: "Vendor Contract (All)" sql_on: ${vendor_snowflake.vendor_id} = ${vendor_contract_all.vendor_id} ;; relationship: one_to_many } join: vw_active_vendor_contract_snowflake { type: inner sql_on: ${vendor_snowflake.vendor_id} = ${vw_active_vendor_contract_snowflake.vendor_id} ;; relationship: one_to_one fields: [] } ## Missing table: vendor_territory_restriction in #join: vendor_territory_restriction { # view_label: "Vendor Territory Restriction (Physical)" # sql_on: ${vw_active_vendor_contract_snowflake.vendor_contract_id}=${vendor_territory_restriction.vendor_contract_id} ;; # relationship: many_to_one #} ## Replaced view name vendor_contract_snowflake_original with name vendor_contract_snowflake join: vendor_contract_active { from: vendor_contract_snowflake view_label: "Vendor Contract (Active)" sql_on: ${vw_active_vendor_contract_snowflake.vendor_contract_id} = ${vendor_contract_active.id} ;; relationship: one_to_one } join: vendor_country { from: country_snowflake view_label: "Vendor (Country)" sql_on: ${vendor_snowflake.country} = ${vendor_country.id} ;; relationship: many_to_one } ## Created view genre_snowflake (copied from internal instance, just changed table name) ## Need the table distribution_format_media in order to have the genre_snowflake file work correctly (dependencies) ## join: genre_snowflake { ## ## changed from: genre_snowflake to dim_genre ## from: dim_genre ## view_label: "Vendor (Genre)" ## sql_on: ${vendor_genre.genreid} = ${vendor_snowflake.primary_genre} ;; ## relationship: many_to_one ## } join: vendor_tax_id_country { from: country_snowflake view_label: "Vendor (Tax ID Country)" sql_on: ${vendor_snowflake.tax_id_country} = ${vendor_tax_id_country.id} ;; relationship: many_to_one } ## Can't find matching table in OEM #join: travelex_snowflake { # view_label: "Vendor (Travelex)" # sql_on: ${travelex_snowflake.vendor_id}= ${vendor_snowflake.vendor_id} ;; # relationship: one_to_one #} join: orchadmin_users_snowflake { view_label: "Vendor (Label Manager)" sql_on: ${vendor_snowflake.assigned_to}=${orchadmin_users_snowflake.id};; relationship: many_to_one fields: [orchadmin_users_snowflake.full_name] } ## Can't find matching table in OEM ## Note that image_asset table is in OEM though. #join: vendor_logo_snowflake { # view_label: "Vendor Logo" # sql_on: ${vendor_snowflake.vendor_id} = ${vendor_logo_snowflake.vendor_id} ;; # relationship: one_to_many #} ## Created the view vend_contact_snowflake join: vend_contact_snowflake { view_label: "Vendor Contact" sql_on: ${vendor_snowflake.vendor_id} = ${vend_contact_snowflake.vendor_id} AND ${vend_contact_snowflake.subaccount_id} IS NULL ;; relationship: many_to_one } ## Missing the table art_relations.contact ## join: contact_snowflake { ## view_label: "Vendor Contact (Detail)" ## sql_on: ${vend_contact_snowflake.contact_id} = ${contact_snowflake.contact_id} ;; ## relationship: many_to_one ## } ## Relies on the contact_snowflake view for the join ## join: contact_country { ## from: country_snowflake ## view_label: "Vendor Contact (Country)" ## sql_on: ${contact_snowflake.orchard_country} = ${contact_country.id} ;; ## relationship: many_to_one ## } ## Relies on the contact_snowflake view for the join ## join: union_contact_alt_email_snowflake { ## view_label: "Vendor Contact (Flatten)" ## sql_on: ${contact_snowflake.contact_id} = ${union_contact_alt_email_snowflake.contact_id} ;; ## relationship: one_to_many ## fields: [union_contact_alt_email_snowflake.contact_email, union_contact_alt_email_snowflake.is_alt] ## } ## Created view subaccount_snowflake (copied from internal instance, just changed table name) join: vendor_accounting_snowflake { view_label: "Vendor Accounting" sql_on: ${vendor_snowflake.vendor_id} = ${vendor_accounting_snowflake.vendor_id} ;; relationship: one_to_many } ## Created view period_snowflake (copied from internal instance, just changed table name) join: vendor_accounting_period_snowflake { from: period_snowflake view_label: "Vendor Accounting (Period)" sql_on: ${vendor_accounting_period_snowflake.period_id} = ${vendor_accounting_snowflake.period_id} ;; relationship: many_to_one } join: vendor_contract_advance_snowflake { view_label: "Vendor Contract (All) Advance" sql_on: ${vendor_contract_advance_snowflake.contract_id}=${vendor_contract_all.id} ;; relationship: one_to_many } join: orchadmin_users_closer_snowflake { from: orchadmin_users_snowflake view_label: "Vendor Contract (Active) Closer" sql_on: try_to_numeric(${vendor_contract_active.orchrep_name}) = ${orchadmin_users_closer_snowflake.id};; relationship: many_to_one } join: artist_country { from: country_snowflake view_label: "Artist (Country)" sql_on: ${artist_info_snowflake.orchard_country}=${artist_country.id} ;; relationship: many_to_one } ## Depends on the genre_snowflake view working - can't use until the distribution table is exposed ## join: release_genre { ## from: genre_snowflake ## view_label: "Release (Genre)" ## sql_on: ${release_genre.genre_id} = ${releases_snowflake.genre_id} ;; ## relationship: many_to_one ## } ## Can't find the distribution_format table in the OEM instance ## join: distribution_format_snowflake { ## view_label: "Release (Distribution Format)" ## sql_on: ${releases_snowflake.distribution_format_id} = ${distribution_format_snowflake.distribution_format_id} ;; ## relationship: many_to_one ## } ## Can't find the distribution_format_media table in the OEM instance ## join: distribution_format_media_snowflake { ## view_label: "Release (Distribution Format Media)" ## sql_on: ${distribution_format_media_snowflake.distribution_format_media_id} = ${distribution_format_media_snowflake.distribution_format_media_id} ;; ## relationship: many_to_one ## } # START: DELIVERABLES / RESTRICTIONS ## Created view vendor_dms_master_restriction_snowflake (copied from internal instance, just changed table name) join: vendor_dms_master_restriction_snowflake { view_label: "Vendor Restrictions (Store)" sql_on: ${vendor_contract_active.id} = ${vendor_dms_master_restriction_snowflake.vendor_contract_id} ;; relationship: one_to_many } join: vdmr_store { from: customer_master_master_snowflake view_label: "Vendor Restrictions (Store)" sql_on: ${vendor_dms_master_restriction_snowflake.customer_master_master_id} = ${vdmr_store.customer_master_master_id} ;; relationship: many_to_one fields: [customer_master_master_id, customer_name] } ## Can't find the distribution_type table in the OEM instance ## join: vdmr_distributiontype { ## from: distribution_type_snowflake ## view_label: "Vendor Restrictions (Store)" ## sql_on: ${vendor_dms_master_restriction_snowflake.distribution_type_id} = ${vdmr_distributiontype.id} ;; ## relationship: many_to_one ## } ## Created view vendor_dms_restriction_snowflake (copied from internal instance, just changed table name) join: vendor_dms_restriction_snowflake { view_label: "Vendor Restrictions (Substore)" sql_on: ${vendor_contract_active.id} = ${vendor_dms_restriction_snowflake.id} ;; relationship: one_to_many } ## Created view customer_master_snowflake (copied from internal instance, just changed table name) join: vdr_customer { from: customer_master_snowflake view_label: "Vendor Restrictions (Substore)" sql_on: ${vendor_dms_restriction_snowflake.dms_id} = ${vdr_customer.customer_id} ;; relationship: many_to_one fields: [name] } join: vdr_store { from: customer_master_master_snowflake view_label: "Vendor Restrictions (Substore)" sql_on: ${vdr_customer.customer_master_master_id} = ${vdr_store.customer_master_master_id} ;; relationship: many_to_one fields: [customer_master_master_id, customer_name] } join: vdr_country { from: country_snowflake view_label: "Vendor Restrictions (Substore)" sql_on: ${vdr_customer.territory} = ${vdr_country.id} ;; relationship: many_to_one fields: [id, abbrivation, country_code, name] } ## Created view vendor_territory_restriction_snowflake_1 (copied from internal instance, just changed table name) join: vendor_territory_restriction_snowflake_1 { view_label: "Vendor Restrictions (Territory)" sql_on: ${vendor_contract_active.id} = ${vendor_territory_restriction_snowflake_1.id} ;; relationship: one_to_many } join: vtr_country { from: country_snowflake view_label: "Vendor Restrictions (Territory)" sql_on: ${vendor_territory_restriction_snowflake_1.country_id} = ${vtr_country.id} ;; relationship: many_to_one fields: [id, abbrivation, country_code, name] } ## Created view subaccount_dms_master_restriction_snowflake (copied from internal instance, just changed table name) join: subaccount_dms_master_restriction_snowflake { view_label: "Subaccount Restrictions (Store)" sql_on: ${subaccount_snowflake.subaccount_id} = ${subaccount_dms_master_restriction_snowflake.subaccount_id} ;; relationship: one_to_many } join: sdmr_store { from: customer_master_master_snowflake view_label: "Subaccount Restrictions (Store)" sql_on: ${subaccount_dms_master_restriction_snowflake.customer_master_master_id} = ${sdmr_store.customer_master_master_id} ;; fields: [customer_master_master_id, customer_name] relationship: many_to_one } ## join: restrictions_aggregated_subaccount_store_snowflake { ## view_label: "Subaccount Restrictions (Store)" ## sql_on: ${subaccount_snowflake.subaccount_id} = ${restrictions_aggregated_subaccount_store_snowflake.subaccount_id} ;; ## relationship: one_to_many ## } ## join: subaccount_dms_restriction_snowflake { ## view_label: "Subaccount Restrictions (Substore)" ## sql_on: ${subaccount_snowflake.subaccount_id} = ${subaccount_dms_restriction_snowflake.subaccount_id} ;; ## relationship: one_to_many ## } ## join: sdr_customer { ## from: customer_master_snowflake ## view_label: "Subaccount Restrictions (Substore)" ## sql_on: ${subaccount_dms_restriction_snowflake.dms_id} = ${sdr_customer.customer_id} ;; ## relationship: many_to_one ## fields: [name] ## } ## join: sdr_store { ## from: customer_master_master_snowflake ## view_label: "Subaccount Restrictions (Substore)" ## sql_on: ${sdr_customer.customer_master_master_id} = ${sdr_store.customer_master_master_id} ;; ## relationship: many_to_one ## fields: [customer_master_master_id, customer_name] ## } ## join: sdr_country { ## from: country_snowflake ## view_label: "Subaccount Restrictions (Substore)" ## sql_on: ${sdr_customer.territory} = ${sdr_country.id} ;; ## relationship: many_to_one ## fields: [id, abbrivation, country_code, name] ## } ## join: restrictions_aggregated_subaccount_substore_snowflake { ## view_label: "Subaccount Restrictions (Substore)" ## sql_on: ${subaccount_snowflake.subaccount_id} = ${restrictions_aggregated_subaccount_substore_snowflake.subaccount_id} ;; ## relationship: one_to_many ## } ## join: subaccount_territory_restriction_snowflake { ## view_label: "Subaccount Restrictions (Territory)" ## sql_on: ${subaccount_snowflake.subaccount_id} = ${subaccount_territory_restriction_snowflake.subaccount_id} ;; ## relationship: one_to_many ## } ## join: str_country { ## from: country_snowflake ## view_label: "Subaccount Restrictions (Territory)" ## sql_on: ${subaccount_territory_restriction_snowflake.country_id} = ${str_country.id} ;; ## relationship: many_to_one ## fields: [id, abbrivation, country_code, name] ## } ## join: restrictions_aggregated_subaccount_territory_snowflake { ## view_label: "Subaccount Restrictions (Territory)" ## sql_on: ${subaccount_snowflake.subaccount_id} = ${restrictions_aggregated_subaccount_territory_snowflake.subaccount_id} ;; ## relationship: one_to_many ## } ## join: release_dms_master_restriction_snowflake { ## view_label: "Release Restrictions (Store)" ## sql_on: ${releases_snowflake.release_id} = ${release_dms_master_restriction_snowflake.release_id} ;; ## relationship: one_to_many ## } ## join: rdmr_store { ## from: customer_master_master_snowflake ## view_label: "Release Restrictions (Store)" ## sql_on: ${release_dms_master_restriction_snowflake.customer_master_master_id} = ${rdmr_store.customer_master_master_id} ;; ## relationship: many_to_one ## fields: [customer_master_master_id, customer_name] ## } ## join: rdmr_distributiontype { ## from: distribution_type_snowflake ## view_label: "Release Restrictions (Store)" ## sql_on: ${release_dms_master_restriction_snowflake.distribution_type_id} = ${rdmr_distributiontype.id} ;; ## relationship: many_to_one ## } ## join: restrictions_aggregated_release_store_snowflake { ## view_label: "Release Restrictions (Store)" ## sql_on: ${releases_snowflake.release_id} = ${restrictions_aggregated_release_store_snowflake.release_id} ;; ## relationship: one_to_many ## } ## join: release_dms_restriction_snowflake { ## view_label: "Release Restrictions (Substore)" ## sql_on: ${releases_snowflake.release_id} = ${release_dms_restriction_snowflake.release_id} ;; ## relationship: one_to_many ## } ## join: rdr_customer { ## from: customer_master_snowflake ## view_label: "Release Restrictions (Substore)" ## sql_on: ${release_dms_restriction_snowflake.dms_customer_id} = ${rdr_customer.customer_id} ;; ## relationship: many_to_one ## fields: [name] ## } ## join: rdr_store { ## from: customer_master_master_snowflake ## view_label: "Release Restrictions (Substore)" ## sql_on: ${rdr_customer.customer_master_master_id} = ${rdr_store.customer_master_master_id} ;; ## relationship: many_to_one ## fields: [customer_master_master_id, customer_name] ## } ## join: rdr_country { ## from: country_snowflake ## view_label: "Release Restrictions (Substore)" ## sql_on: ${rdr_customer.territory} = ${rdr_country.id} ;; ## relationship: many_to_one ## fields: [id, abbrivation, country_code, name] ## } ## join: restrictions_aggregated_release_substore_snowflake { ## view_label: "Release Restrictions (Substore)" ## sql_on: ${releases_snowflake.release_id} = ${restrictions_aggregated_release_substore_snowflake.release_id} ;; ## relationship: one_to_many ## } ## join: release_territory_restriction_snowflake { ## view_label: "Release Restrictions (Territory)" ## sql_on: ${releases_snowflake.release_id} = ${release_territory_restriction_snowflake.release_id} ;; ## relationship: one_to_many ## } ## join: rtr_country { ## from: country_snowflake ## view_label: "Release Restrictions (Territory)" ## sql_on: ${release_territory_restriction_snowflake.country_id} = ${rtr_country.id} ;; ## relationship: many_to_one ## fields: [id, abbrivation, country_code, name] ## } ## join: restrictions_aggregated_release_territory_snowflake { ## view_label: "Release Restrictions (Territory)" ## sql_on: ${releases_snowflake.release_id} = ${restrictions_aggregated_release_territory_snowflake.release_id} ;; ## relationship: one_to_many ## } ## join: deliverable_digital_release_snowflake { ## view_label: "Deliverable for Digital (Release)" ## sql_on: ${releases_snowflake.release_id} = ${deliverable_digital_release_snowflake.release_id} ;; ## relationship: one_to_one ## } ## join: deliverable_digital_subaccount_snowflake { ## view_label: "Deliverable for Digital (Subaccount)" ## sql_on: ${subaccount_snowflake.subaccount_id} = ${deliverable_digital_subaccount_snowflake.subaccount_id} ;; ## relationship: one_to_one ## } ## join: deliverable_digital_vendor_snowflake { ## view_label: "Deliverable for Digital (Label)" ## sql_on: ${vendor_snowflake.vendor_id} = ${deliverable_digital_vendor_snowflake.vendor_id} ;; ## relationship: one_to_one ## } ## join: deliverable_perf_rights_snowflake { ## type: inner ## view_label: "Deliverable for Performance Rights" ## sql_on: ${releases_snowflake.release_id} = ${deliverable_perf_rights_snowflake.release_id} ;; ## relationship: one_to_one ## } # END: DELIVERABLES / RESTRICTIONS join: manual_adjustment { view_label: "Manual Adjustment" relationship: one_to_many type: inner sql_on: ${vendor_snowflake.vendor_id} = ${manual_adjustment.parent_id} AND ${manual_adjustment.parent_type} = 'vendor' ;; fields: [detail*, -category_id, -category] } join: period_snowflake { view_label: "Manual Adjustment (Period)" sql_on: ${manual_adjustment.apply_to_period_id} = ${period_snowflake.period_id} ;; relationship: many_to_one } join: manual_adjustment_category { view_label: "Manual Adjustment" sql_on: ${manual_adjustment_category.category_id} = ${manual_adjustment.category_id} ;; relationship: many_to_one } ## Created new view file currencies_snowflake join: manual_adjustment_local_currency { from: currencies_snowflake view_label: "Manual Adjustment (Local Currency)" sql_on: ${manual_adjustment_local_currency.id} = ${manual_adjustment.currencies_id} ;; relationship: many_to_one # relationship: one_to_one } join: bvcs_vendor_max_period_id { sql_on: ${manual_adjustment.parent_id} = ${bvcs_vendor_max_period_id.vendor_id} ;; relationship: many_to_one fields: [] } join: booked_vendor_contract_snapshot { type: inner sql_on: ${bvcs_vendor_max_period_id.vendor_id} = ${booked_vendor_contract_snapshot.vendor_id} AND ${bvcs_vendor_max_period_id.max_period_id} = ${booked_vendor_contract_snapshot.period_id} ;; relationship: one_to_one fields: [vendor_id] } join: bvcs_exchange_rates { from: currency_exchange_rates sql_on: ${manual_adjustment.apply_to_period_id} = ${bvcs_exchange_rates.period_id} AND ${manual_adjustment.currencies_id} = ${bvcs_exchange_rates.currency_from_id} AND ${booked_vendor_contract_snapshot.currency_id} = ${bvcs_exchange_rates.currency_to_id} ;; relationship: one_to_one fields: [] } join: bvcs_currency { from: currencies_snowflake view_label: "Manual Adjustment (Reporting Currency)" sql_on: ${bvcs_exchange_rates.currency_to_id} = ${bvcs_currency.id} ;; relationship: many_to_one # relationship: one_to_one } join: release_manual_adjustment_snowflake { type: inner view_label: "Release Manual Adjustment" sql_on: ${release_manual_adjustment_snowflake.vendor_manual_adjustment_id} = ${manual_adjustment.id} -- AND ${release_manual_adjustment_snowflake.release_id} = ${releases_snowflake.release_id} AND ${release_manual_adjustment_snowflake.release_id} = ${releases_snowflake.release_id} AND ${release_manual_adjustment_snowflake.currencies_id} = ${release_manual_adjustment_exrate_usd.currency_from_id};; relationship: one_to_many fields: [detail*, -category_id] } join: release_manual_adjustment_category { from: manual_adjustment_category view_label: "Release Manual Adjustment" sql_on: ${release_manual_adjustment_category.category_id} = ${release_manual_adjustment_snowflake.category_id} ;; relationship: many_to_one } join: release_manual_adjustment_currencies { from: currencies_snowflake view_label: "Release Manual Adjustment (Local Currency)" sql_on: ${release_manual_adjustment_currencies.id} = ${release_manual_adjustment_snowflake.currencies_id} ;; relationship: many_to_one # relationship: one_to_one } join: release_manual_adjustment_exrate_usd { from: currency_exchange_rates sql_on: ${manual_adjustment.apply_to_period_id} = ${release_manual_adjustment_exrate_usd.period_id} AND ${release_manual_adjustment_exrate_usd.currency_to_id} = 1 ;; relationship: many_to_one fields: [] } join: bvcs_exchange_rates_rma { from: currency_exchange_rates sql_on: ${manual_adjustment.apply_to_period_id} = ${bvcs_exchange_rates_rma.period_id} AND ${release_manual_adjustment_snowflake.currencies_id} = ${bvcs_exchange_rates_rma.currency_from_id} AND ${booked_vendor_contract_snapshot.currency_id} = ${bvcs_exchange_rates_rma.currency_to_id} ;; relationship: one_to_one fields: [] } join: bvcs_currency_rma { from: currencies_snowflake view_label: "Release Manual Adjustment (Reporting Currency)" sql_on: ${bvcs_exchange_rates_rma.currency_to_id} = ${bvcs_currency_rma.id} ;; relationship: many_to_one } # join: deleted_labels_snowflake_fd { # view_label: "Deleted Labels" # sql_on: ${deleted_labels_snowflake_fd.vendor_id}=${vendor_snowflake.vendor_id} ;; # relationship: one_to_one # } # # join: deleted_labels_snowflake_vn { # view_label: "Deleted Labels" # sql_on: ${deleted_labels_snowflake_vn.vendor_id}=${vendor_snowflake.vendor_id} ;; # relationship: one_to_one # } # # join: releases_log_snowflake { # view_label: "Relases Log" # sql_on: ${releases_snowflake.release_id}=${releases_log_snowflake.release_id} ;; # relationship: many_to_one # } # # join: signed_labels_deleted_content { # view_label: "Deleted Labels" # sql_on: ${vendor_snowflake.vendor_id}=${signed_labels_deleted_content.vendor_id} ;; # relationship: one_to_one # } }