url_decode¶
url_decode(url_encoded_string)
Description¶
Decode url_encoded_string
(inspired from this stackoverflow solution)
Examples¶
Call or Deploy url_decode
?
Call url_decode
directly
The easiest way to use bigfunctions
url_decode
function is deployed in 39 public datasets for all of the 39 BigQuery regions.- It can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
- (You need to use the dataset in the same region as your datasets otherwise you may have a function not found error)
Public BigFunctions Datasets
Region | Dataset |
---|---|
eu |
bigfunctions.eu |
us |
bigfunctions.us |
europe-west1 |
bigfunctions.europe_west1 |
asia-east1 |
bigfunctions.asia_east1 |
... | ... |
Deploy url_decode
in your project
Why deploy?
- You may prefer to deploy
url_decode
in your own project to build and manage your own catalog of functions. - This is particularly useful if you want to create private functions (for example calling your internal APIs).
- Get started by reading the framework page
Deployment
url_decode
function can be deployed with:
pip install bigfunctions
bigfun get url_decode
bigfun deploy url_decode
select bigfunctions.eu.url_decode('http%3A%2F%2Fwww.example.com%2Fhello%3Fv%3D12345')
select bigfunctions.us.url_decode('http%3A%2F%2Fwww.example.com%2Fhello%3Fv%3D12345')
select bigfunctions.europe_west1.url_decode('http%3A%2F%2Fwww.example.com%2Fhello%3Fv%3D12345')
+--------------------------------------+
| string |
+--------------------------------------+
| http://www.example.com/hello?v=12345 |
+--------------------------------------+
Need help or Found a bug using url_decode
?
Get help using url_decode
The community can help! Engage the conversation on Slack
We also provide professional suppport.
Report a bug about url_decode
If the function does not work as expected, please
- report a bug so that it can be improved.
- or open the discussion with the community on Slack.
We also provide professional suppport.
Use cases¶
You have a table in BigQuery that stores URLs, but some of these URLs are URL-encoded (meaning special characters are replaced with percent signs followed by hexadecimal codes). You want to decode these URLs to their original, readable form.
Example Scenario:
Let's say you have a table named website_traffic
with a column called encoded_url
. This column contains URL-encoded strings like this:
'https%3A%2F%2Fwww.example.com%2Fproducts%3Fid%3D123%26source%3Dgoogle'
You can use the url_decode
function to decode these URLs within a query:
SELECT url_decode(encoded_url) AS decoded_url
FROM `your_project.your_dataset.website_traffic`;
This query would produce a result set with a decoded_url
column containing the properly decoded URLs:
https://www.example.com/products?id=123&source=google
Use Cases:
- Log Analysis: Web server logs often store URLs in a URL-encoded format. Decoding them makes the logs more human-readable and easier to analyze.
- Data Cleaning: If you have URL data from different sources, some might be encoded and some might not. Using
url_decode
ensures consistency in your data. - Reporting: Presenting decoded URLs in reports makes the information clearer and more understandable for stakeholders.
- Data Integration: If you're integrating data from a system that provides URL-encoded URLs, you'll need to decode them before storing or processing them in BigQuery.
In essence, whenever you encounter URL-encoded strings in your BigQuery data and need to work with the actual URLs, the url_decode
function becomes indispensable.
Spread the word!¶
BigFunctions is fully open-source. Help make it a success by spreading the word!