Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Stored Procedure for Apache Spark #16953

Comments

@marblejenka
Copy link

marblejenka commented Jan 10, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

BigQuery Stored procedures for Apache Spark is introduced as a public preview feature.

Stored procedure is already supported by #4493 , so we can just add a new kind of stored procedure in resource_bigquery_routine.

New or Affected Resource(s)

Affected resource

  • google_bigquery_routine

Potential Terraform Configuration

resource "google_bigquery_dataset" "test" {
	dataset_id = "<%= ctx[:vars]['dataset_id'] %>"
}

resource "google_bigquery_connection" "test" {
	dataset_id = "<%= ctx[:vars]['dataset_id'] %>"
	spark { }
}

resource "google_bigquery_routine" "pyspark" {
  dataset_id = google_bigquery_dataset.test.dataset_id
  routine_id     = "<%= ctx[:vars]['routine_id'] %>"
  routine_type = "PROCEDURE"
  language = "PYTHON"
  connection = google_bigquery_connection.test.id
  definition_body = <<-EOS
    from pyspark.sql import SparkSession

    spark = SparkSession.builder.appName("spark-bigquery-demo").getOrCreate()
    
    # Load data from BigQuery.
    words = spark.read.format("bigquery") \
      .option("table", "bigquery-public-data:samples.shakespeare") \
      .load()
    words.createOrReplaceTempView("words")
    
    # Perform word count.
    word_count = words.select('word', 'word_count').groupBy('word').sum('word_count').withColumnRenamed("sum(word_count)", "sum_word_count")
    word_count.show()
    word_count.printSchema()
    
    # Saving the data to BigQuery
    word_count.write.format("bigquery") \
      .option("writeMethod", "direct") \
      .save("wordcount_dataset.wordcount_output")
  EOS
}

References

b/319619249

@marblejenka
Copy link
Author

I will work on this issue.

@github-actions github-actions bot added forward/review In review; remove label to forward service/bigquery labels Jan 10, 2024
marblejenka added a commit to marblejenka/magic-modules that referenced this issue Jan 10, 2024
@shuyama1 shuyama1 removed the forward/review In review; remove label to forward label Jan 10, 2024
roaks3 pushed a commit to GoogleCloudPlatform/magic-modules that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
modular-magician added a commit to modular-magician/docs-examples that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to terraform-google-modules/docs-examples that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to modular-magician/terraform-provider-google-beta that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this issue Jan 17, 2024
* impl for hashicorp#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit that referenced this issue Jan 17, 2024
* impl for #16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to hashicorp/terraform-provider-google-beta that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to modular-magician/terraform-google-conversion that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to GoogleCloudPlatform/terraform-google-conversion that referenced this issue Jan 17, 2024
* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
[upstream:5f50107bb30977b84230a3c526f2f9b404a40684]

Signed-off-by: Modular Magician <magic-modules@google.com>
bskaplan pushed a commit to bskaplan/magic-modules that referenced this issue Jan 17, 2024
…m#9793)

* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
kylase pushed a commit to yuanchuankee/magic-modules that referenced this issue Jan 21, 2024
…m#9793)

* impl for hashicorp/terraform-provider-google#16953

* modified format in example

* modified tab to space

* added test for update and test for coverage

* mofify all resource in the spark option section

* modified connection id to avoid conflict
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.