til.duyet.net
blog
Search…
til.duyet.net
🤪
Today I Learned
Data Engineering
☁
AWS
⚒
Tools
💻
Shell
☸
Kubernetes, Helm, Kustomize
🔄
Apache Airflow
🐳
Docker
Database
Google BigQuery
BigQuery Cancel Running Query
BigQuery - Split string and get the first part
BigQuery - UNNEST in SELECT
Bigquery - Sample queries for audiences based
BigQuery cookbook for Google Analytics Exported Data
Apache Hive
AWS Redshift / Postgres
Presto
Programming
🍪
Rust
🐍
Python
👻
Golang
💎
Javascript / Typescript
✨
FE / React
Unix
Git - Pretty git branch graphs
Checking files in Docker build context
Bash get the directory of the current script
Vim
Find and replace
Miscellaneous
[Fig] Single machine and distributed system structure
Deploying Machine Learning Models at Scale
Bypass a Chrome certificate/HSTS error
Articles
Powered By GitBook
BigQuery - Split string and get the first part
Using SPLIT(value[, delimiter]) returns an array.
Then using SAFE_OFFSET(zero_based_offset) or SAFE_ORDINAL(one_based_offset) to get item from array.
1
SELECT SPLIT(app_info.version, '-')[SAFE_OFFSET(0)] as app_version
2
FROM ...
Copied!
References:
  • ​https://cloud.google.com/bigquery/docs/reference/standard-sql/string_functions#split​
  • ​https://cloud.google.com/bigquery/docs/reference/standard-sql/array_functions#safe_offset_and_safe_ordinal​
Previous
BigQuery Cancel Running Query
Next
BigQuery - UNNEST in SELECT
Last modified 1yr ago
Copy link
Edit on GitHub