tableau-apitableau-desktoptableau-prep

Tableau Prep: How can I refer to a parameter in the Custom SQL query?


Using Tableau Prep Builder version 2021.4.4 I connected to Postgresql database (version 12) and created a Custom Query as the only input in the Flow. Then I created a parameter (my_date). In the custom query I have: select my_field from my_table where date = -- How can I refer to my_date?

I have already tried the following but all failed:

where date = ${my_date}-- syntax error at or near "$" 
where date = $my_date  -- syntax error at or near "$"
where date = :my_date  -- syntax error at or near ":"
where date = (my_date) -- "my_date" does not exist
where date = my_date   -- "my_date" does not exist
where date = $1        -- Index 0 out of bounds for length 0

Solution

  • Use < > , for example:

    where date = <my_date>
    

    OR

    where date = '<my_date>'