I am uploading the file from Google Storage Bucket to the BQ table. I am running a Cloud Function similar to shown below. I am able to run and deploy it successfully but I could see many files are not getting uploaded to the BQ table. I am getting the error[1] .
I am not even using the flask. How do I understand this error?
error[1]
"response = self.full_dispatch_request() :
at .wsgiu_app (…pip/lib/python3.12/site-packages/flask.app.pt:2529)"
Cloud Function :
from google.cloud import storage, bigquery
def move_to_bigquery(data, context):
bucket_name = data[‘bucket’]
file_name = data[‘name’]
project_id = ‘your-project-id’
dataset_id = ‘your-dataset-id’
table_id = ‘your-table-id’
gcs_uri = f"gs://{bucket_name}/{file_name}"
job_config = bigquery.LoadJobConfig( autodetect=True, source_format=bigquery.SourceFormat.NEWLINE_DELIMITED_JSON, )
table_ref = bigquery_client.dataset(dataset_id).table(table_id)
load_job = bigquery_client.load_table_from_uri(gcs_uri, table_ref, job_config=job_config)
load_job.result()