@@ -459,10 +459,10 @@ <h2 is-upgraded>Setup your project for function deployment</h2>
459
459
iam_admin_client = iam_admin_v1.IAMClient()
460
460
request = types.CreateServiceAccountRequest()
461
461
462
+ account_id = "bigframes-no-permissions"
462
463
request.account_id = account_id
463
464
request.name = f"projects/{project_id}"
464
465
465
- account_id = "bigframes-no-permissions"
466
466
display_name = "bigframes remote function (no permissions)"
467
467
service_account = types.ServiceAccount()
468
468
service_account.display_name = display_name
@@ -480,6 +480,9 @@ <h2 is-upgraded>Setup your project for function deployment</h2>
480
480
bqclient.create_dataset(dataset, exists_ok=True)
481
481
</ code > </ pre >
482
482
< h2 is-upgraded > Deploying a remote function</ h2 >
483
+ < p > Enable the Cloud Functions API if not yet already enabled.</ p >
484
+ < pre > < code > !gcloud services enable cloudfunctions.googleapis.com
485
+ </ code > </ pre >
483
486
< p > Now, deploy your function to the dataset you just created. Add a < code > @bpd.remote_function</ code > decorator to the function you created in the previous steps.</ p >
484
487
< pre > < code > import bigframes.pandas as bpd
485
488
@@ -494,7 +497,7 @@ <h2 is-upgraded>Deploying a remote function</h2>
494
497
# TODO: Replace this with your version of nltk.
495
498
packages=["nltk==3.9.1"],
496
499
# Replace this with your service account email.
497
- cloud_function_service_account="bigframes-no-permissions@your-project-id .iam.gserviceaccount.com",
500
+ cloud_function_service_account=f "bigframes-no-permissions@{project_id} .iam.gserviceaccount.com",
498
501
cloud_function_ingress_settings="internal-only",
499
502
)
500
503
def lemmatize(word: str) -> str:
@@ -525,7 +528,7 @@ <h2 is-upgraded>Using the remote functions</h2>
525
528
bpd.options.bigquery.ordering_mode = "partial"
526
529
bpd.options.display.repr_mode = "deferred"
527
530
528
- lemmatize = bpd.read_gbq_function("swast-scratch .functions.lemmatize")
531
+ lemmatize = bpd.read_gbq_function(f "{project_id} .functions.lemmatize")
529
532
530
533
words = bpd.Series(["whiskies", "whisky", "whiskey", "vodkas", "vodka"])
531
534
words.apply(lemmatize).to_pandas()
0 commit comments