s3_destinations:
  mysql:
    data:   s3://{env}-db-data/sql2sf/{db_host}/{source_schema}/{source_table}/{date_range}/data/dump.gz
    schema: s3://{env}-db-data/sql2sf/{db_host}/{source_schema}/{source_table}/{date_range}/table_schema.json

queries:
  redshift:
    snapshot: SELECT * FROM {source_schema}.{source_table}
    date_range: >
      SELECT * FROM {source_schema}.{source_table}
      WHERE {source_date_col}
        BETWEEN \'{start_period}\' AND \'{end_period}\'
    sync_incremental: >
      SELECT * FROM {source_schema}.{source_table}
      WHERE {source_date_col} > \'{start_period}\'
        AND {source_date_col} <= \'{end_period}\'
  mysql:
    snapshot: SELECT * FROM `{source_schema}`.`{source_table}`  # TODO: not in use for now, check if we need it

# Comment table if you want to exclude it from syncing
db_hosts:
  reportsar02:
    db_type: mysql
    schemas:
      accountingflat:
        db_config:
          host: ENV[REPORTSAR02_ART_RELATIONS_HOST]
          port: ENV[REPORTSAR02_ART_RELATIONS_PORT]
          user: ENV[REPORTSAR02_ART_RELATIONS_USER]
          password: ENV[REPORTSAR02_ART_RELATIONS_PASSWORD]
        tables:
          dig_sales_detail:
            sanity_threshold: 0
            wrap_to_stripspecialchars_long: True
            wrap_to_convert_unicode:
              - track_name
            primary_key: statement_detail_id
            unload_in_chunks: True
            chunk_size: 50000000
            exclude_from_daily_sync: True
          passthru_processed:
            sanity_threshold: 0
            wrap_to_stripspecialchars_long: True
            primary_key: statement_detail_id
            unload_in_chunks: True
            chunk_size: 50000000
            exclude_from_daily_sync: True
  statements:
    db_type: mysql
    schemas:
      stmt-db:
        db_config:
          host: ENV[MYSQL_STATEMENTS_HOST]
          port: ENV[MYSQL_STATEMENTS_PORT]
          user: ENV[MYSQL_STATEMENTS_USER]
          password: ENV[MYSQL_STATEMENTS_PASSWORD]
        tables:
#          dig_sales:
#           sanity_threshold: 0
          dig_sales_period_id:
            sanity_threshold: 0
          remaps:
            sanity_threshold: 0
          remaps_physical:
            sanity_threshold: 0
          dmgi_match:
            sanity_threshold: 0
          fx_rates:
            sanity_threshold: 0
          fx_rates_payout:
            sanity_threshold: 0
          snowflake_resolutions:
            sanity_threshold: 0
          dig_sales_detail_archive_202:
            wrap_to_convert_unicode:
              - artist_name
              - track_name
              - release_name
            exclude_from_daily_sync: True
            sanity_threshold: 0
            primary_key: archive_id
            unload_in_chunks: True
            chunk_size: 100000000
          dig_sales_detail_archive_185:
            wrap_to_convert_unicode:
              - artist_name
              - track_name
              - release_name
            exclude_from_daily_sync: True
            sanity_threshold: 0
            primary_key: archive_id
            unload_in_chunks: True
            chunk_size: 100000000
          dig_sales_detail_archive:
            wrap_to_convert_unicode:
              - artist_name
              - track_name
              - release_name
            exclude_from_daily_sync: True
            sanity_threshold: 0
            primary_key: archive_id
            unload_in_chunks: True
            chunk_size: 100000000
          red_vendors:
            sanity_threshold: 0
            wrap_to_stripspecialchars: True
          supply_chain_vendors:
            sanity_threshold: 0
            wrap_to_stripspecialchars: True
          bad_upc:
            sanity_threshold: 0
