Hi folks,
I have a derived view with some SQL like this
derived_table: {
sql:
{% assign foo = _filters['foo'] | url_encode %}
{% assign bar = _filters['bar'] | url_encode %}
{% assign filters = 'foo=' | append: foo | append: '&bar=' | append: bar %}
select {{ filters | sql_quote }} as filters
;;
}
The LookML validator complains, that I should use `sql_quote` on all `_filter[]` usages. Is there a way to get rid of the warning?
I’m not that familiar with Liquid yet.
Hi there!
Here’s the liquid variable reference section re: sql_quote:
Seems like it wants you to append
| sql_quote
to your assign statements
Hi Abil,
thanks for the reply. As far as I understand what sql_quote does, I end up with too many single quotes in the final string.
e.g.
assuming _filters['foo'] == "a" and _filters['bar'] == "b"
would result in a final string as:
foo='a'&bar='a'
But I don’t want the additional single-quotes on the filters.
But what I could do, is do the string concatenation in SQL rather than Liquid
select concat('foo=', {{foo}}, '&bar=', {{bar}} ) as filters
Unfortunately I cannot try it out right now, since I am locked out of Looker for unknown reason ?♂️