https://prefect.io logo
Title
t

Triet Le

01/26/2023, 5:03 PM
Hi team, I am new to prefect and GCP. In bigquery_create_table() from
prefect_bigquery
lib, what should I fill in the
location
param if I’ve specified the region for my GCP project as asia-southeast1? I’ve tried to leave it as default (“US”),fill it as
None
,
Asia
,
ASIA
, and
asia-southeast1
,but it’s kept showing the same error as below
File <my_path_to_venv>/lib/python3.10/site-packages/prefect_gcp/bigquery.py", line 223, in bigquery_create_table
    client = gcp_credentials.get_bigquery_client(project=project, location=location)
AttributeError: 'SecretDict' object has no attribute 'get_bigquery_client'
👀 1
1
a

Andrew Huang

01/26/2023, 5:18 PM
wanted to ask, how did you instantiate gcp_credentials?
t

Triet Le

01/26/2023, 5:30 PM
Here’s my snippet
gcp_cred = GcpCredentials.load(<my_block_name>).service_account_info

table_name = bigquery_create_table(
            dataset=dataset,
            table=table,
            gcp_credentials=gcp_cred,
            external_config=external_config,
            location="asia-southeast1")
return table_name
a

Andrew Huang

01/26/2023, 5:35 PM
no need to use the
service_account_info
property; simply pass in gcp_cred
gcp_cred = GcpCredentials.load(<my_block_name>)

table_name = bigquery_create_table(
            dataset=dataset,
            table=table,
            gcp_credentials=gcp_cred,
            external_config=external_config,
            location="asia-southeast1")
t

Triet Le

01/26/2023, 5:58 PM
thanks, Andrew!
1
a

Andrew Huang

01/26/2023, 6:08 PM
no problem! let me know if you have further questions.
🙌 1
1