Prevent Automatic TO_CHAR()

PaulM1
New Member

Using Snowflake backend.

I’ve got a dimension like this:

  dimension: orderdate_ntz_param_tz_offset {
    type: date_time
    convert_tz: no
    datatype: date
    sql: DATEADD(HOUR, {% parameter p_TimeZoneOffset_Hours %},DATEADD(MINUTE, {% parameter p_TimeZoneOffset_Minutes %}, ${TABLE}."ORDERDATE_NTZ")) ;;
  }

The resulting SQL always ends up being nested in a TO_CHAR():

TO_CHAR(DATEADD(HOUR, '2',DATEADD(MINUTE, '0', v_orders_f."ORDERDATE_NTZ")) , 'YYYY-MM-DD HH24:MI:SS') AS "v_orders_f.orderdate_ntz_param_tz_offset"

Is there anyway to prevent this?

0 2 517
2 REPLIES 2

you could use a seperate DIM_TIME/DATE Table with this logic. Then Join your OERDERDATE_NTZ with this table. Then you should not see this problem anymore

I encounter the same issue.
Why TO_CHAR() is added? what is it for? What is the side effect if I remove it?

Top Labels in this Space
Top Solution Authors