Я пытаюсь добавить новые строки в существующую таблицу больших запросов из CSV-файла. CSV:
"sprotocol";"w5q53";"insertingdate";"closeddate";"sollectidate";"company";"companyid";"contact"
"20-22553";"DELETED";"2020-01-26;0000-01-01 00:00";"0000-01-01 00:00";"";"";"this is a ticket"
Это моя python функция:
job_config = bigquery.LoadJobConfig()
job_config.source_format = 'text/csv'
job_config.write_disposition = bigquery.WriteDisposition.WRITE_APPEND
job_config.source_format = bigquery.SourceFormat.CSV
job_config.skip_leading_rows = 1
job_config.autodetect = False
job_config.schema = [
bigquery.SchemaField("sprotocol", "STRING", mode="NULLABLE"),
bigquery.SchemaField("w5q53", "STRING", mode="NULLABLE"),
bigquery.SchemaField("insertingdate", "TIMESTAMP", mode="NULLABLE"),
bigquery.SchemaField("closeddate", "STRING", mode="NULLABLE"),
bigquery.SchemaField("sollectidate", "STRING", mode="NULLABLE"),
bigquery.SchemaField("company", "STRING", mode="NULLABLE"),
bigquery.SchemaField("companyid", "STRING", mode="NULLABLE"),
bigquery.SchemaField("contact", "STRING", mode="NULLABLE")
]
job_config.fieldDelimiter = ';'
job_config.allow_quoted_newlines = True
with open(file_path, "rb") as file:
load_job = _connection.load_table_from_file(
file,
table_ref,
job_config=job_config
) # API request
print("Starting job {}".format(load_job.job_id))
load_job.result() # Waits for table load to complete.
print("Job finished.")
file.close()
Я получаю следующую ошибку:
[{'reason': 'invalid', 'message': 'Error while reading data, error message: CSV table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the errors[] collection for more details.'}, {'reason': 'invalid', 'message': 'Error while reading data, error message: CSV table references column position 55, but line starting at position:743 contains only 1 columns.'}]
Я пробовал также удалить определение схемы, но я получаю ту же ошибку. Кто-нибудь может мне помочь?