提问人:unnest_me 提问时间:10/18/2023 更新时间:10/18/2023 访问量:104
从 CSV 文件创建外部 Bigquery 表 - 错误:缺少右引号字符 (“)
Creating External Bigquery table from CSV file - Error: missing closed quote character (")
问:
我在 google cloud 存储桶中存储了多个 CSV 文件。我创建了一个气流 DAG 任务,该任务将所有这些文件放在同一个存储桶中并创建一个外部表,因为所有这些文件都遵循相同的架构,只是数据不同。我现在在尝试查询此数据时遇到了问题。我收到的错误是:
读取表时出错:irm-eap-edp-ingestion-nonprod.route4me.routes_external,错误消息:缺少右引号字符 (“).;line_number:78 byte_offset_to_start_of_line:19620 column_index:7 column_name:“destination_name”column_type:字符串值:“调查#87/1,87...”文件:gs://irm-eap-edp-ingestion-nonprod-us-archive/route4me_data/Detailed-Routes-2023-08-29.csv
所以在2023-08-29文件中说,“destination_name”一栏有问题
我在 VSCode 中打开了这个文件,并在那一行看到了这个。 destination_name列数据是分布在 4 行上的浅蓝色数据。
“调查#87/1、87/2、88、89/1和122, Byranahalli 村,Kasaba Hobli, 内拉曼加拉·塔鲁克, 班加罗尔北部 – 562123”
因此,它会认为它有问题,因为此记录的行中有多个换行符。但是,在我的任务中,我启用了:“allow_quoted_newlines”:True。我以为这会解决这个问题,因为引号内有换行符。这不是正确的选择吗?我做错了什么,这是我的气流任务:
create_external_table = BigQueryUpsertTableOperator(
task_id=f"create_external_{TABLE}_table",
dataset_id=DATASET,
project_id=INGESTION_PROJECT_ID,
table_resource={
"tableReference": {"tableId": f"{TABLE}_external"},
"externalDataConfiguration": {
"sourceFormat": "CSV",
"schema": {"fields": schema},
"allow_quoted_newlines": True,
"allow_jagged_rows":True,
"autodetect": True,
"sourceUris": [f"gs://{ARCHIVE_BUCKET}/{DATASET}_data/*.csv"],
},
"labels": labeler.get_labels_bigquery_table_v2(
target_project=INGESTION_PROJECT_ID,
target_dataset=DATASET,
target_table=f"{TABLE}_external",
),
},
)
答: 暂无答案
评论