1

I am working in Snowflake and have a column pets that I'm trying to put into a url friendly format so they can be concatenated to links within Metabase. Example:

'Tom & Jerry' -> 'Tom%20%26%20Jerry'

Is there a function in Snowflake that does this?

1 Answer 1

1

I don't think there is one. But Javascript has sush a thing, so we can wrap that into a function:

create function urlencodestring(str string)
returns string
language javascript
strict
as
'
    return encodeURIComponent(STR);
';

then go crazy:

select urlencodestring('Tom & Jerry');
URLENCODESTRING('TOM & JERRY')
Tom%20%26%20Jerry
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.