from typing import Dict, Optional, Tuple, Any DEFAULT_TRACK_IN_CHART_ORDER_BY = "country_name" # order_by params to fields mapping. # For dim_country.COUNTRYNAME we use NULLS FIRST because "GLOBAL" country code has a mapping of null, # and we need it to be on the first position with this kind of sorting # Only default order by is handled on a database level, # for the rest we use multikeysort on the result we get from cache order_by_param_to_field_mapping = { "current_position": "track_in_chart_most_recent_position", DEFAULT_TRACK_IN_CHART_ORDER_BY: "dim_country.COUNTRYNAME NULLS FIRST" }