Skip to content

Commit f2ea2ee

Browse files
author
ddeleo
committed
Fix READMEs and ingored_files in cloud build triggers
1 parent e328c6f commit f2ea2ee

File tree

3 files changed

+51
-25
lines changed

3 files changed

+51
-25
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This repository is broken up into:
2828
* [UDFs](/udfs) - User-defined functions for common usage as well as migration
2929
* [community](/udfs/community) - Community contributed user-defined
3030
functions
31+
* [datasketches](/udfs/datasketches) - UDFs deployed from the latest release of [Apache Datasketches for BigQuery](https://github.com/apache/datasketches-bigquery)
3132
* [migration](/udfs/migration) - UDFs which mimic the behavior of
3233
proprietary functions in the following databases:
3334
* [netezza](/udfs/migration/netezza)

release/terraform/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ resource "google_cloudbuild_trigger" "regional_trigger" {
5050
}
5151
}
5252
included_files = ["udfs/**", "stored_procedures/**"]
53-
ignored_files = ["cloudbuild.yaml", ".*\\.md", "images/*", "tools/**", "udfs/datasketches/**"]
53+
ignored_files = ["**/*.md"]
5454
include_build_logs = "INCLUDE_BUILD_LOGS_WITH_STATUS"
5555

5656
substitutions = {

udfs/README.md

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@ function using another SQL expression or JavaScript. These functions accept
77
columns of input and perform actions, returning the result of those actions as a
88
value.
99

10-
## Community and Migration Functions
11-
12-
The [community](/udfs/community) folder contains community-contributed functions
13-
that perform some actions in BigQuery. The [migration](/udfs/migration) folder
14-
contains sub-folders such as [teradata](/udfs/migration/teradata),
15-
[redshift](/udfs/migration/redshift), [sqlserver](/udfs/migration/sqlserver) and [oracle](/udfs/migration/oracle) which
16-
contain community-contributed functions that replicate the behavior of
17-
proprietary functions in other data warehouses. These functions can help you
18-
achieve feature parity in a migration from another data warehouse to BigQuery.
10+
## Repo Folder to BigQuery Dataset Mappings
11+
12+
> [!IMPORTANT]
13+
> The UDF datasets listed below reside in US multi-region, but are also available in all other supported BigQuery locations as described in the [Using the UDFs](#using-the-udfs) section.
14+
15+
| Repo Folder | BigQuery UDF Dataset | Description |
16+
|-----------------------------------------------------|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
17+
| [`community/`](/udfs/community) | [`bqutil.fn`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2sfn) | Contains an assortment of community-contributed functions. |
18+
| [`datasketches/`](/udfs/datasketches/) | [`bqutil.datasketches`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2sdatasketches) | Contains an open source, high-performance library of stochastic streaming algorithms commonly called "sketches". The source for these UDFs are maintained in the apache/datasketches-bigquery repo, but are available in the bqutil.datasketches US multi-region dataset and all other regions as described in Using the UDFs section. |
19+
| [`migration/oracle/`](/udfs/migration/oracle) | [`bqutil.or`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2sor) | Contains community-contributed functions that replicate the behavior of Oracle functions. |
20+
| [`migration/redshift/`](/udfs/migration/redshift) | [`bqutil.rs`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2srs) | Contains community-contributed functions that replicate the behavior of Redshift functions. |
21+
| [`migration/snowflake/`](/udfs/migration/snowflake) | [`bqutil.sf`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2ssf) | Contains community-contributed functions that replicate the behavior of Snowflake functions. |
22+
| [`migration/sqlserver/`](/udfs/migration/sqlserver) | [`bqutil.ss`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2sss) | Contains community-contributed functions that replicate the behavior of SQL Server functions. |
23+
| [`migration/teradata/`](/udfs/migration/teradata/) | [`bqutil.td`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2std) | Contains community-contributed functions that replicate the behavior of Teradata functions. |
24+
| [`migration/vertica/`](/udfs/migration/vertica) | [`bqutil.ve`](https://console.cloud.google.com/bigquery?ws=!1m4!1m3!3m2!1sbqutil!2sve) | Contains community-contributed functions that replicate the behavior of Vertica functions. |
1925

2026
## Using the UDFs
2127

@@ -26,23 +32,20 @@ publicly shared datasets. Queries can then reference the shared UDFs in the US m
2632
UDFs within this repository are also deployed publicly into every other region that [BigQuery supports](https://cloud.google.com/bigquery/docs/locations).
2733
In order to use a UDF in your desired location outside of the US multi-region, you can reference it via a dataset with a regional suffix:
2834

29-
`bqutil.<dataset>_<region>.<function>()`.
35+
`bqutil.<dataset>_<region>.<function>()`
3036

3137
For example, the Teradata `nullifzero` can be referenced in various locations:
3238

33-
```
34-
bqutil.td_eu.nullifzero() ## eu multi-region
35-
36-
bqutil.td_europe_west1.nullifzero() ## europe-west1 region
39+
```sql
40+
bqutil.td_eu.nullifzero() -- eu multi-region
3741

38-
bqutil.td_asia_south1.nullifzero() ## asia-south1 region
42+
bqutil.td_europe_west1.nullifzero() -- europe-west1 region
3943

44+
bqutil.td_asia_south1.nullifzero() -- asia-south1 region
4045
```
4146

42-
Note: Region suffixes added to dataset names replace `-` with `_` in order to comply with BigQuery dataset naming rules.
43-
44-
45-
![Alt text](/images/public_udf_architecture.png?raw=true "Public UDFs")
47+
> [!NOTE]
48+
> Region suffixes added to dataset names replace `-` with `_` in order to comply with BigQuery dataset naming rules.
4649
4750
## Deploying the UDFs
4851

@@ -60,6 +63,8 @@ The following sections cover a few methods of deploying the UDFs.
6063

6164
### Deploy with Cloud Build (Recommended)
6265

66+
<details><summary><b>&#128466; Click to expand step-by-step instructions</b></summary>
67+
6368
1. Authenticate using the Cloud SDK and set the BigQuery project in which you'll
6469
deploy your UDF(s):
6570

@@ -86,13 +91,19 @@ The following sections cover a few methods of deploying the UDFs.
8691
# Deploy to US
8792
gcloud builds submit . --config=deploy.yaml --substitutions _PROJECT_ID=YOUR_PROJECT_ID,_BQ_LOCATION=US
8893
```
89-
> Note: Deploy to a different location by setting `_BQ_LOCATION` to your own
94+
95+
> IMPORTANT:
96+
> Deploy to a different location by setting `_BQ_LOCATION` to your own
9097
> desired value.\
9198
> [Click here](https://cloud.google.com/bigquery/docs/locations#supported_regions)
9299
> for a list of supported locations.
93100
101+
</details>
102+
94103
### Deploy with your own machine
95104

105+
<details><summary><b>&#128466; Click to expand step-by-step instructions</b></summary>
106+
96107
Run the following in your machine's terminal to deploy all UDFs in your own
97108
BigQuery project.
98109

@@ -117,13 +128,19 @@ BigQuery project.
117128
# Deploy to US
118129
export BQ_LOCATION=US && bash deploy.sh
119130
```
120-
> Note: Deploy to a different location by setting `BQ_LOCATION` to your own
131+
132+
> IMPORTANT:
133+
> Deploy to a different location by setting `BQ_LOCATION` to your own
121134
> desired value.\
122135
> [Click here](https://cloud.google.com/bigquery/docs/locations#supported_regions)
123136
> for a list of supported locations.
124137
138+
</details>
139+
125140
### Deploy with bq command-line tool or BigQuery Console
126141

142+
<details><summary><b>&#128466; Click to expand step-by-step instructions</b></summary>
143+
127144
If you want to create the UDFs from this repository using the bq command-line
128145
tool, then you must make a few modifications to the SQLX files as shown below:
129146

@@ -138,8 +155,12 @@ tool, then you must make a few modifications to the SQLX files as shown below:
138155
```
139156
* BigQuery Console: Just paste the SQL UDF body in the console and execute.
140157

158+
</details>
159+
141160
### Using JavaScript UDFs
142161

162+
<details><summary><b>&#128466; Click to expand step-by-step instructions</b></summary>
163+
143164
When
144165
creating [JavaScript UDFs](https://cloud.google.com/bigquery/docs/reference/standard-sql/user-defined-functions#javascript-udf-structure)
145166
in your dataset, you need both to create the UDF and optionally copy the
@@ -153,7 +174,7 @@ UDF function, that uses the `js-levenshtein-v1.1.6.js` library.
153174

154175
1. Copy the compiled library to your bucket:
155176
`gsutil cp gs://bqutil-lib/bq_js_libs/js-levenshtein-v1.1.6.js gs://your-bucket`
156-
2. Give permissions to the library. First, if you don't
177+
1. Give permissions to the library. First, if you don't
157178
have [uniform bucket-level access](https://cloud.google.com/storage/docs/using-uniform-bucket-level-access)
158179
in your bucket, enable
159180
it: `gsutil uniformbucketlevelaccess set on gs://your-bucket`. Once done give
@@ -163,13 +184,17 @@ UDF function, that uses the `js-levenshtein-v1.1.6.js` library.
163184
or [project](https://cloud.google.com/sdk/gcloud/reference/projects/add-iam-policy-binding)
164185
level to a user or
165186
group: `gsutil iam ch [user|group]:[user|group]@domain.com:roles/storage.objectViewer gs://your_bucket`
166-
3. Edit the [levenshtein.sql](community/levenshtein.sql) SQL file and replace
187+
1. Edit the [levenshtein.sql](community/levenshtein.sql) SQL file and replace
167188
the library path `library="${JS_BUCKET}/js-levenshtein-v1.1.6.js"` with your
168189
own path `library="gs://your-bucket/js-levenshtein-v1.1.6.js`
169-
4. Create the SQL UDF passing the previously modified SQL file:
190+
1. Create the SQL UDF passing the previously modified SQL file:
170191
`bq query --project_id YOUR_PROJECT_ID --dataset_id YOUR_DATASET_ID --nouse_legacy_sql < levenshtein.sql`
171192
193+
</details>
194+
172195
## Contributing UDFs
173196
197+
![Alt text](/images/public_udf_architecture.png?raw=true "Public UDFs")
198+
174199
If you are interested in contributing UDFs to this repository, please see the
175200
[instructions](/udfs/CONTRIBUTING.md) to get started.

0 commit comments

Comments
 (0)