【发布时间】:2018-04-25 15:26:36
【问题描述】:
我正在尝试将 CSV 文件上传到大型查询数据库,但是我不断收到以下消息。
RuntimeError: [{'reason': 'invalid', 'location': 'kid=70943:mkey=customer_encrypt_cns/file-00000000', 'message': 'Error while reading data, error message: CSV table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the error stream for more details.'}, {'reason': 'invalid', 'location': 'kid=70943:mkey=customer_encrypt_cns/file-00000000', 'message': 'Error while reading data, error message: CSV table references column position 1, but line starting at position:0 contains only 1 columns.'}]
csv 中的数据与架构匹配,作为测试,我只上传 5 行 8 列,例如
2018-02-02 x 0.1 2.4 0 0 0.88 0.4
2018-02-03 y 0.1 3 0 0 0.87 0.21
2018-02-04 z 0.1 2.8 0 0 0.86 0.21
2018-02-05 a 0.1 2.4 0 0 0.91 0.21
2018-02-06 b 0.1 1.9 0 0 1.00 0.4
为什么说我只有一栏?
【问题讨论】:
-
这看起来像一个 tab 分隔的文件,而不是逗号分隔的文件。您是否指定了适当的分隔符?
-
CSV 是一个逗号分隔的文件。但在您的数据样本中没有逗号。您确定要上传逗号分隔的文件吗?
标签: python database google-bigquery