version: 2

sources:
  - name: engagement_data
    database: FANSIFTER
    schema: PROD
    description: Source containing data processed in the Orchard account
    tables:
      - name: spotify_forward_lean_unique_fan_count
        identifier: FANSIFTER_METRIC_DATA_FINAL
  - name: fansifter
    schema: "{{ 'PROD' if target.name == 'prod' else 'QA' }}"
    description: Source containing data ingested outside of DBT audience but used in this project
    tables:
      - name: shopify_store_association
        description: This is table containing list of Fivetran connectors and identities
        identifier: SHOPIFY_STORE_ASSOCIATION
      - name: shopify_collection_artist
        description: This is mapping between Shopify collection and global participant
        identifier: SHOPIFY_COLLECTION_ARTIST
      - name: songwhip_presave
        identifier: SONGWHIP_PRESAVE
      - name: songwhip_fan_consent
        identifier: SONGWHIP_FAN_CONSENT
      - name: songwhip_fan_consent_double_opt_in
        identifier: SONGWHIP_FAN_CONSENT_DOUBLE_OPT_IN
      - name: songwhip_page_unlock
        identifier: SONGWHIP_PAGE_UNLOCK
      - name: standard_location_region
        identifier: LOCATION_REGION
      - name: standard_location_city
        identifier: LOCATION_CITY
      - name: standard_location_postal_code
        identifier: LOCATION_POSTAL_CODE
      - name: sendgrid_webhook_general
        identifier: SENDGRID_WEBHOOK_GENERAL
      - name: email_campaign
        identifier: EMAIL_CAMPAIGN
      - name: artist_roster
        identifier: ARTIST_ROSTER
      - name: artist_roster_main_rep
        identifier: ARTIST_ROSTER_MAIN_REP
      - name: artist_roster_local_rep
        identifier: ARTIST_ROSTER_LOCAL_REP
      - name: twilio_fan_subscription_status
        identifier: TWILIO_FAN_SUBSCRIPTION_STATUS
      - name: text_campaign_artist_phone_number
        identifier: TEXT_CAMPAIGN_ARTIST_PHONE_NUMBER
      - name: twilio_webhook_inbound
        identifier: TWILIO_WEBHOOK_INBOUND
      - name: ccpa_fan_list
        description: Table containing fans who opted out of retargeting based on CCPA law (managed via Backoffice Streamlit app)
        identifier: CCPA_FAN_LIST
  - name: crm
    description: Source for tables ingested from Salesforce Customer Relationship Manager product
    database: DELPHI_CRM_DATA
    schema: RAW_SALESFORCE_SALES_CLOUD
    tables:
      - name: artist_c
        description: Table containing artist related data
        identifier: ARTIST_C
      - name: fan_c
        description: Table containing fan related data
        identifier: FAN_C
      - name: subscription_c
        description: Table containing email subscription related data
        identifier: SUBSCRIPTION_C
      - name: mailing_list_c
        description: Table containing mailing lists related data
        identifier: MAILING_LIST_C
      - name: tla_c
        description: Table containing territory label artist relationship
        identifier: TLA_C
      - name: territory_c
        description: Table containing territory related data
        identifier: TERRITORY_C
      - name: label_c
        description: Table containing music label related data
        identifier: LABEL_C
      - name: form_c
        description: Table containing campaign forms related data
        identifier: FORM_C
      - name: form_response_c
        description: Table containing responses from campaigns
        identifier: FORM_RESPONSE_C
      - name: deleted_record_c
        description: Table containing data about deleted records
        identifier: DELETED_RECORD_C
      - name: load_ccpa_list_c
        description: Table containing fans who opted out of retargeting based on CCPA law
        identifier: LOAD_CCPA_LIST_C
      - name: fan_history
        description: Table containing data about fan history- data changes
        identifier: FAN_HISTORY
      - name: promotion_c
        description: Table containing promotion related data
        identifier: PROMOTION_C
      - name: preference_c
        description: Table containing fan preference related data
        identifier: PREFERENCE_C
      - name: fan_retarget_c
        description: Table containing fan retargeting consent (applicable to DE, AT, NO territories)
        identifier: FAN_RETARGET_C
  - name: ae
    description: Source for third party data collected by Appreciation Engine
    database: DELPHI_EXPLORATION
    schema: MAIN
    tables:
      - name: ae_member
        description: Table containing fan related data collected by AE
        identifier: AE_MEMBER
      - name: ae_member_personal
        description: Table containing additional fan related data collected by AE
        identifier: AE_MEMBER_PERSONAL
      - name: ae_activities_feed
        description: Table containing fan activities for related artists collected by AE from different sources
        identifier: AE_ACTIVITIES_FEED
      - name: ae_brand
        description: Table containing artists related data
        identifier: AE_BRAND
      - name: ae_segment
        description: Table containing AE segments related data
        identifier: AE_SEGMENT
      - name: ae_members_opt_ins
        description: Table containing AE member opt ins for segments
        identifier: AE_MEMBERS_OPT_INS
  - name: sme_shopify
    description: Source for Shopify e-commerce data collected through SME integration
    database: CRM_ECOMMERCE_DATA
    schema: CONSOLIDATION_DATA
    tables:
      - name: ecommerce_orders
        description: Table containing orders data
        identifier: ECOMMERCE_ORDERS
      - name: ecommerce_stores
        description: Table containing stores data
        identifier: ECOMMERCE_STORES
  - name: sme_email
    description: Source for email related data ingested from Salesforce Marketing Cloud
    database: DELPHI_CRM_DATA
    schema: RAW_SALESFORCE_MARKETING_CLOUD
    tables:
      - name: sfmc_job_tracking
        description: Table containing email related data used for joining with artists and accounts
        identifier: SFMC_JOB_TRACKING
      - name: sfmc_sent_tracking
        description: Table containing send data
        identifier: SFMC_SENT_TRACKING
      - name: sfmc_click_tracking
        description: Table containing email clicks data
        identifier: SFMC_CLICK_TRACKING
      - name: sfmc_open_tracking
        description: Table containing email opens data
        identifier: SFMC_OPEN_TRACKING
  - name: shopify
    description: Source for Shopify e-commerce data collected through Fansifter integration
    schema: "{{ 'PROD_SHOPIFY' if target.name == 'prod' else 'QA_SHOPIFY' }}"
    tables:
      - name: order_line
        description: Table containing detailed order data regarding each item purchased
        identifier: SHOPIFY_ORDER_LINE
      - name: order
        description: Table containing more general order related data
        identifier: SHOPIFY_ORDER
      - name: collection_product
        description: Table about product collection relationships
        identifier: SHOPIFY_COLLECTION_PRODUCT
      - name: customer
        description: Table containing customer data
        identifier: SHOPIFY_CUSTOMER
  - name: facts
    description: Source for Orchard's data used for mapping artists with different identifiers
    database: FACTS
    schema: PROD
    tables:
      - name: global_participant
        description: Table containing data for artists identifiers
        identifier: GLOBAL_PARTICIPANT
      - name: vendor
        description: Table containing data for vendors
        identifier: VENDOR
      - name: dim_subaccount
        description: Table containing data for subaccounts and corresponding vendor ids
        identifier: DIM_SUBACCOUNT
      - name: company_brand
        description: Table containing company brands
        identifier: COMPANY_BRAND
      - name: company_brand_has_label_vendor
        description: Table with a Vendor - Company Brand mapping
        identifier: COMPANY_BRAND_HAS_LABEL_VENDOR
      - name: global_participant_merged_to_global_participant
        identifier: GLOBAL_PARTICIPANT_MERGED_TO_GLOBAL_PARTICIPANT
      - name: dim_currency
        identifier: DIM_CURRENCY
      - name: dim_country
        identifier: DIM_COUNTRY
  - name: songwhip
    database: SONGWHIP_APP_REPORTING
    schema: "{{ 'PROD' if target.name == 'prod' else 'QA' }}_SONGWHIP_API_PUBLIC"
    tables:
      - name: albums
        identifier: ALBUMS
      - name: albums_accounts
        identifier: ALBUMS_ACCOUNTS
      - name: accounts
        identifier: ACCOUNTS
      - name: artists
        identifier: ARTISTS
      - name: paths
        identifier: PATHS
      - name: prereleases
        identifier: PRERELEASES
      - name: prereleases_accounts
        identifier: PRERELEASES_ACCOUNTS
      - name: custom_pages
        identifier: CUSTOM_PAGES
      - name: custom_pages_accounts
        identifier: CUSTOM_PAGES_ACCOUNTS
  - name: crm_fans
    description: Schema where file upload related fan data is
    database: FANSIFTER_APP_REPORTING
    schema: "{{ 'PROD' if target.name == 'prod' else 'qa' }}_CRM_FANS"
    tables:
      - name: event_fanresponse_validated
        description: Table containing validated fan data
        identifier: EVENT_FANRESPONSE_VALIDATED
      - name: file_upload_campaigns
        description: Table with campaign data based on file upload
        identifier: FILE_UPLOAD_CAMPAIGNS
      - name: event_file_upload
        description: Table containing manually uploaded fan data
        identifier: EVENT_FILE_UPLOAD
  - name: delphi_exploration
    description: Source for Delphi system tables used for access control
    database: DELPHI_EXPLORATION
    schema: SYS
    tables:
      - name: dsp_id_to_user_mapping
        description: Table mapping DSP IDs to Snowflake roles for row-level security
        identifier: DSP_ID_TO_USER_MAPPING
  - name: bandsintown
    database: FAN_LIVE_EVENTS
    schema: PROD
    description: Source containing raw data from Bandsintown
    tables:
      - name: raw_bandsintown_artist_optins
        description: Table containing fan opt ins for a specific Sony artist
        identifier: RAW_BANDSINTOWN_ARTIST_OPTINS
      - name: raw_bandsintown_sony_optins
        description: Table containing fan opt ins for a SME
        identifier: RAW_BANDSINTOWN_SONY_OPTINS
      - name: raw_bandsintown_rsvp
        description: Table containing fan clicks on the RSVP button
        identifier: RAW_BANDSINTOWN_RSVP
      - name: raw_bandsintown_tracking
        description: Table containing fan clicks on the FOLLOW button
        identifier: RAW_BANDSINTOWN_TRACKING
      - name: raw_bandsintown_ticketclick
        description: Table containing fan clicks on the TICKETS button
        identifier: RAW_BANDSINTOWN_TICKETCLICK
