@@ -677,10 +677,10 @@ from google.cloud.iam_admin_v1 import types
677
677
iam_admin_client = iam_admin_v1.IAMClient()
678
678
request = types.CreateServiceAccountRequest()
679
679
680
+ account_id = "bigframes-no-permissions"
680
681
request.account_id = account_id
681
682
request.name = f"projects/{project_id}"
682
683
683
- account_id = "bigframes-no-permissions"
684
684
display_name = "bigframes remote function (no permissions)"
685
685
service_account = types.ServiceAccount()
686
686
service_account.display_name = display_name
@@ -704,7 +704,13 @@ bqclient.create_dataset(dataset, exists_ok=True)
704
704
705
705
### Deploying a remote function
706
706
707
- Now, deploy your function to the dataset you just created. Add a
707
+ Enable the Cloud Functions API if not yet already enabled.
708
+
709
+ ```
710
+ !gcloud services enable cloudfunctions.googleapis.com
711
+ ```
712
+
713
+ Now, deploy your function to the dataset you just created. Add a
708
714
` @bpd.remote_function ` decorator to the function you created in the previous
709
715
steps.
710
716
@@ -722,7 +728,7 @@ bpd.options.display.repr_mode = "deferred"
722
728
# TODO: Replace this with your version of nltk.
723
729
packages=["nltk==3.9.1"],
724
730
# Replace this with your service account email.
725
- cloud_function_service_account="bigframes-no-permissions@your-project-id .iam.gserviceaccount.com",
731
+ cloud_function_service_account=f "bigframes-no-permissions@{project_id} .iam.gserviceaccount.com",
726
732
cloud_function_ingress_settings="internal-only",
727
733
)
728
734
def lemmatize(word: str) -> str:
@@ -759,7 +765,7 @@ import bigframes.pandas as bpd
759
765
bpd.options.bigquery.ordering_mode = "partial"
760
766
bpd.options.display.repr_mode = "deferred"
761
767
762
- lemmatize = bpd.read_gbq_function("swast-scratch .functions.lemmatize")
768
+ lemmatize = bpd.read_gbq_function(f"{project_id} .functions.lemmatize")
763
769
764
770
words = bpd.Series(["whiskies", "whisky", "whiskey", "vodkas", "vodka"])
765
771
words.apply(lemmatize).to_pandas()
0 commit comments