I'm trying to make a call to a table in my Retool database. The nuance is that I'm using a query builder to generate SQL that I can use to add some WHERE conditions.
This is quite strange - my transformer code is as follows:
console.log("test");
return "WHERE TRUE";
Super simple....
And my query is as follows:
And I keep getting these cryptic errors:
Would love any insights!
Here's the specific example that's breaking:
And the console error:
Here's another possible clue:
Here's the text SQL query it generates:
SELECT
shop_id,
initial_utm_content, utm_content,
initial_utm_source, utm_source,
initial_utm_term, utm_term,
initial_utm_campaign, utm_campaign,
initial_utm_medium, utm_medium,
initial_referrer, referrer,
how_did_you_hear_about_archive,
where_did_you_hear_about_us
FROM
temp_shop_channels
WHERE
how_did_you_hear_about_archive LIKE 'Instagram';
Strangely, when I run the query without the transformer (literally pasting that directly in the retool query editor and running it), it works fine.
Try going to Resources --> Hover over retool database and click setting (on the right) --> enable "Disable converting queries to prepared statements".
I think then your first attempt should work. Otherwise you can also return an Array from a javascript have the column name at index 0 and value at index 1 and do something like where {{array[0]}} = {{array[1]}}
LOL goddam. I had accidentally unchecked "Disable converting queries to prepared statements"
thank you! Just realized this.