Skip to content

Commit

Permalink
add bigquery routine remote function example
Browse files Browse the repository at this point in the history
  • Loading branch information
obada-ab committed Feb 21, 2024
1 parent 988a2dd commit ef97c05
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 6 deletions.
14 changes: 11 additions & 3 deletions mmv1/products/bigquery/Routine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,34 @@ examples:
dataset_id: 'dataset_id'
routine_id: 'routine_id'
- !ruby/object:Provider::Terraform::Examples
name: 'big_query_routine_pyspark'
name: 'bigquery_routine_pyspark'
primary_resource_id: 'pyspark'
vars:
dataset_id: 'dataset_id'
connection_id: 'connection_id'
routine_id: 'routine_id'
- !ruby/object:Provider::Terraform::Examples
name: 'big_query_routine_pyspark_mainfile'
name: 'bigquery_routine_pyspark_mainfile'
primary_resource_id: 'pyspark_mainfile'
vars:
dataset_id: 'dataset_id'
connection_id: 'connection_id'
routine_id: 'routine_id'
- !ruby/object:Provider::Terraform::Examples
name: 'big_query_routine_spark_jar'
name: 'bigquery_routine_spark_jar'
primary_resource_id: 'spark_jar'
vars:
dataset_id: 'dataset_id'
connection_id: 'connection_id'
routine_id: 'routine_id'
- !ruby/object:Provider::Terraform::Examples
skip_test: true
name: 'bigquery_routine_remote_function'
primary_resource_id: 'remote_function'
vars:
dataset_id: 'dataset_id'
connection_id: 'connection_id'
routine_id: 'routine_id'
properties:
- !ruby/object:Api::Type::NestedObject
name: routineReference
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
resource "google_bigquery_dataset" "test" {
dataset_id = "<%= ctx[:vars]['dataset_id'] %>"
}

resource "google_bigquery_connection" "test" {
connection_id = "<%= ctx[:vars]['connection_id'] %>"
location = "US"
cloud_resource { }
}

resource "google_bigquery_routine" "<%= ctx[:primary_resource_id] %>" {
dataset_id = google_bigquery_dataset.test.dataset_id
routine_id = "<%= ctx[:vars]['routine_id'] %>"
routine_type = "SCALAR_FUNCTION"
definition_body = ""

return_type = "{\"typeKind\" : \"STRING\"}"

remote_function_options {
endpoint = "https://us-east1-my_gcf_project.cloudfunctions.net/remote_add"
connection = google_bigquery_connection.test.name
max_batching_rows = "10"
user_defined_context = {
"z": "1.5",
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ resource "google_storage_bucket_object" "object" {
}
resource "google_cloudfunctions2_function" "default" {
name = "function-v2"
name = "function-v2-0"
location = "us-central1"
description = "a new function"
Expand Down Expand Up @@ -289,9 +289,9 @@ resource "google_storage_bucket_object" "object" {
}
resource "google_cloudfunctions2_function" "default2" {
name = "function-v2.1"
name = "function-v2-1"
location = "us-central1"
description = "a new function"
description = "a new new function"
build_config {
runtime = "nodejs18"
Expand Down

0 comments on commit ef97c05

Please sign in to comment.