How to Resolve a Module Error in Google Cloud when Adding a Python Step to Interface with Google BigQuery?

This topic was automatically generated from Slack. You can find the original thread here.

Hi everyone. I’m trying to add a Python step to interface with Google BigQuery and I’m getting a module error on google.cloud. I used the magic command to install the google-cloud-bigquery package so I’m at a loss. Any ideas?

Hi , can you try adding the imports at the beginning of the code step:

# pipedream add-package google-cloud-bigquery
from google.cloud import bigquery

def handler(pd: "pipedream"):
    return {"foo": {"test": True}}

Looks like that did the trick, thank you! If anyone else is struggling with BQ here are the other packages I had to install to get things working.

# pipedream add-package db_dtypes
# pipedream add-package pandas
# pipedream add-package google-cloud-bigquery

import google.cloud
from google.cloud import bigquery
from google.oauth2 import service_account

def handler(pd: "pipedream"):
    
    pass