Load filter suggestions for dynamic sql_table_name

Hello All,

I have a scenario where I need to pick a database/schema for a table based on a user selection

below are the example lookml views and explore definitions

view: db_selector {
  parameter: db {
    type: unquoted
    allowed_value: {label: "Database 1" value: "x_schema"}
    allowed_value: {label: "Database 2" value: "y_schema"}
    default_value: "x_schema"
  }
}

view: table_a {
  sql_table_name: {% if db_selector.db._parameter_value=="x_schema" %}"x_schema"{% elsif db_selector.db._parameter_value=="y_schema" %}"y_schema"{% else %} "x_schema"{% endif %}.table_a ;;

  dimension: location_city {
    type: string
    description: "City Name"
    sql: ${TABLE}.city ;;
  }
}

explore: table_a {
  always_join: [db_selector]
  description: "This view has one row per location"
  always_filter: {
    filters: [db_selector.db: "y_schema"]
  }
  join: db_selector {}
}

Everything works fine at look/query sql except for filter suggestions. The filter suggestions always fetch suggestion from “x_schema” (or default schema) even when “y_schema” is picked by the user

Is there a way to get around it ? Thanks in advance

0 0 306
0 REPLIES 0
Top Labels in this Space
Top Solution Authors