cleanse_name()
Utility to make a string SQL safe so that it can be used as an alias for a new column.
Takes the following actions on a string:
remove double quotes
replace spaces and dashes with underscores
cast to upper case
delete anything that is not letters, numbers, or underscores
if first character is a number, add an underscore to the beginning
Parameters
Type
Description
string
text to make SQL safe; works on column names, table names, row values, etc...
Example
SELECT *
<div data-gb-custom-block data-tag="-"></div>
, {{math_op}} as {{cleanse_name(math_op)}}
<div data-gb-custom-block data-tag="-"></div>
FROM {{source_table}}
Last updated
Was this helpful?