Search code examples
looker-studiolookerlookml

Does Looker automatically cast datatypes in dimensions?


I'm changing a view definition in Looker so it points to a different table with nearly the same schema as the previous table. For example, both of my tables have end_date fields, but in the first table the data type is a string and in the new table it is a date.

Will Looker automatically convert to the required data types?

To be concrete, I have the following view definition:

view: view_name {
  sql_table_name: `project.dataset.table`
    ;;

  dimension: end_date {
    type: string
    sql: ${TABLE}.end_date ;;
  }
}

Is looker smart enough so I don't have to change the view definition? Or do I have to update the view definition to be the following code?

view: view_name {
  sql_table_name: `project.dataset.new_table`
    ;;

  dimension: end_date {
    type: date
    sql: ${TABLE}.end_date ;;
  }
}

Solution

  • Turns out: YES, Looker is smart enough for that.