将 CSV 文件从 Google Cloud Storage 导入 Google Cloud SQL [英] Import CSV file from Google Cloud Storage to Google Cloud SQL

查看:48
本文介绍了将 CSV 文件从 Google Cloud Storage 导入 Google Cloud SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I am trying to import a csv file directly into Google Cloud SQL using the command below.

LOAD DATA LOCAL INFILE "gs:/zuds/stg/ems/product_offering_fact/000002_0" INTO TABLE buydoc CHARACTER SET "utf8" FIELDS TERMINATED BY "^";

For some reason, it is returning an error like below. I have confirmed that the file exists. However, notice that the path in the error string has only one '/' Is this a bug or am I missing something obvious?

ERROR 2 (HY000) at line 1: File 'gs:/zuds/stg/ems/product_offering_fact/000002_0' not found (Errcode: 2)

Note:If I use the UI described in the link below, it works. However, the UI does not support non-comma delimited files. https://cloud.google.com/sql/docs/import-export

解决方案

Cloud SQL doesn't support running LOAD DATA LOCAL INFILE with "gs://" path. From the UI, as the doc suggests, only comma delimited files are supported at this point. Here are two workarounds:

  1. Transform your file to CSV and do an import through UI
  2. Download your gs:// file to your local disk and then run LOAD DATA LOCAL INFILE pointing to the path on your local disk.

这篇关于将 CSV 文件从 Google Cloud Storage 导入 Google Cloud SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆