I have an application for an application that loads data into a bigquery table using the google apps launcher, but when I run it on a local host or in the cloud, I get a "No" module named "cloud" when using the error message with google.cloud error import bigquery log file error. I installed the Google Cloud Client Library, but it still gives me the same error. see below the code i use
--- the main.py file contains
import argparse import time import uuid from google.cloud import bigquery def load_data_from_gcs(dataset_name, table_name, source): bigquery_client = bigquery.Client() dataset = bigquery_client.dataset(dataset_name) table = dataset.table(table_name) job_name = str(uuid.uuid4()) job = bigquery_client.load_table_from_storage( job_name, table, source) job.begin() wait_for_job(job) print('Loaded {} rows into {}:{}.'.format( job.output_rows, dataset_name, table_name)) def wait_for_job(job): while True: job.reload() if job.state == 'DONE': if job.error_result: raise RuntimeError(job.error_result) return time.sleep(1) if __name__ == '__main__': parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('Test') parser.add_argument('mytable') parser.add_argument('gs://week/geninfo.csv') args = parser.parse_args() load_data_from_gcs( args.dataset_name, args.table_name, args.source)
- The app.yaml file contains the following code
application: mycloudproject version: 1 runtime: python27 api_version: 1 threadsafe: yes handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: .* script: main.app
Please let me know what is missing, or if I am doing something wrong here?
source share