Skip to content

Commit 54ea10e

Browse files
committed
fix sample code
1 parent 70625db commit 54ea10e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

2024/12-pydata-global/index.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,10 @@ from google.cloud.iam_admin_v1 import types
677677
iam_admin_client = iam_admin_v1.IAMClient()
678678
request = types.CreateServiceAccountRequest()
679679
680+
account_id = "bigframes-no-permissions"
680681
request.account_id = account_id
681682
request.name = f"projects/{project_id}"
682683
683-
account_id = "bigframes-no-permissions"
684684
display_name = "bigframes remote function (no permissions)"
685685
service_account = types.ServiceAccount()
686686
service_account.display_name = display_name
@@ -704,7 +704,13 @@ bqclient.create_dataset(dataset, exists_ok=True)
704704

705705
### Deploying a remote function
706706

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
708714
`@bpd.remote_function` decorator to the function you created in the previous
709715
steps.
710716

@@ -722,7 +728,7 @@ bpd.options.display.repr_mode = "deferred"
722728
# TODO: Replace this with your version of nltk.
723729
packages=["nltk==3.9.1"],
724730
# 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",
726732
cloud_function_ingress_settings="internal-only",
727733
)
728734
def lemmatize(word: str) -> str:
@@ -759,7 +765,7 @@ import bigframes.pandas as bpd
759765
bpd.options.bigquery.ordering_mode = "partial"
760766
bpd.options.display.repr_mode = "deferred"
761767
762-
lemmatize = bpd.read_gbq_function("swast-scratch.functions.lemmatize")
768+
lemmatize = bpd.read_gbq_function(f"{project_id}.functions.lemmatize")
763769
764770
words = bpd.Series(["whiskies", "whisky", "whiskey", "vodkas", "vodka"])
765771
words.apply(lemmatize).to_pandas()

0 commit comments

Comments
 (0)