https://github.com/tuancamtbtx/gcp-udfs-example
Google BigQuery Javascript UDF Function Examples
https://github.com/tuancamtbtx/gcp-udfs-example
bigquery gcp javascript nodejs npm udf
Last synced: 12 months ago
JSON representation
Google BigQuery Javascript UDF Function Examples
- Host: GitHub
- URL: https://github.com/tuancamtbtx/gcp-udfs-example
- Owner: tuancamtbtx
- Created: 2023-10-27T04:51:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-02T16:24:39.000Z (over 2 years ago)
- Last Synced: 2025-02-22T06:13:44.117Z (over 1 year ago)
- Topics: bigquery, gcp, javascript, nodejs, npm, udf
- Language: JavaScript
- Homepage:
- Size: 103 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Google BigQuery Javascript UDF Function Examples

## Progaming language

## Install
```
nvm use
npm install
```
## Lint Code
Before push this code to Github (Please run)
```
npm run lint
```
## Testing
To run unit tests:
```
npm run test
```
To run the distribution asset tests:
```
npm run build
npm run test:dist
````
## Deploy
*This requires your terminal to be authenticated with the GCloud SDK*
```
export DEST_BUCKET=your_bucket_name
export GCP_PROJECT=your_project_gcp_id
npm run build
npm run deploy
```
*To Create UDF Function on A Dataset Bigquery*
```
CREATE FUNCTION `${dataset_name}`.stringFormatter(input STRING)
RETURNS STRING
LANGUAGE js
OPTIONS (
library=["gs://js-udfs/bigquery-js-udf-example/dist/dist.js"]
)
AS r"""
return stringFormatter.format(input);
"""
;
SELECT `${dataset_name}`.stringFormatter("I am Tuan Cam ") AS result;
```