Templated filter causing a - Syntax error: Unexpected '{' - in compiled SQL

KatieH
Participant I

I’m trying to use templated filtering in a View and it keeps throwing a syntax error when I try to use an Explore built from this view.

Looking at the compiled SQL, the special { character is not being recognized by the compiler, so it’s throwing a syntax error.

I’ve used the exact same logic in other Views, so I’m not too sure what I’m doing wrong here 🤔

Here’s the top of the code block for the view:

view: client_analytics_sessions_events_funnel {
  derived_table: {
    sql:
    WITH get_event_rank AS (
      SELECT
      session_id,
      MIN(client_event_name) AS client_event_name,
      MIN(event_rank_in_session) AS event_rank_in_session,
      MIN(action_event_rank_in_session) AS action_event_rank_in_session,
      MIN(screen_event_rank_in_session) AS screen_event_rank_in_session

      FROM `monzo-analytics.prod.client_analytics_sessions_events`

      WHERE {% condition funnel_start_client_event_name %} client_event_name {% endcondition %}
      AND {% condition timeframe %} client_event_ts {% endcondition %}

      GROUP BY 1
    ),

Here’s the error that’s getting thrown when I try to build an Explore from this view:

Not too sure what’s going on here…any ideas welcome!

0 2 565
2 REPLIES 2

KatieH
Participant I

Just to add:
the filter exists in the View and there’s no typos, so I’m not sure why it’s not recognizing/compiling the { % condition funnel_start_client_event_name %} ...

Maddie
Participant IV

Hi Katie,

Could you please post the definition of the two filters used, i.e. funnel_start_client_event_name and timeframe?

And do they exist in other joined in views? Sometimes it may require specific reference, i.e. view_name.funnel_start_client_event_name if there are a few of them with the same name.

Best,
Maddie | Redkite

Top Labels in this Space
Top Solution Authors