以下のサイトを参考にしています。
https://qiita.com/itkr/items/20aa3e408ab3b83d54af
下記のコードでなぜか、以下のようなエラーがでてしまいます。
特に間違えている引数はないと思うのですが、他になにか確認スべき点お気づきになりましたらご教示いただけませんでしょうか?
bigquery.errors.JobInsertException: Reason:invalid. Message:Empty schema specified for the load job. Please specify a schema that describes the data being loaded.
python
1json_key_file = str(Path.home()) + '/_key.json' 2 3 client = get_client(project_id, json_key_file=json_key_file, readonly=False) 4 5 with open(path_schema_info, 'r') as f: 6 table_schema = json.load(f) 7 8 if not client.check_dataset(dataset): 9 raise Exception 10 11 if not client.check_table(dataset, table_name): 12 client.create_table(dataset, table_name, table_schema) 13 14 path_csv_file = ["gs://" + bucket_name + "/" + csv_file_name] 15 16 client.import_data_from_uris(path_csv_file, dataset, table_name, schema=table_schema, source_format=JOB_SOURCE_FORMAT_CSV, skip_leading_rows=1) 17
json
1{ 2"t_date":"STRING" 3,"s_id":"STRING" 4,"set_date":"STRING" 5,"test_id":"STRING" 6,"test_name":"STRING" 7,"aid":"STRING" 8,"aname":"STRING" 9,"s_type":"STRING" 10,"k_kekka":"INTEGER" 11}
回答1件
あなたの回答
tips
プレビュー