Closed4
cloud sqlでデータをインポートする方法

GUIから
Cloud SQLでインスタンスを選択したあとの概要ページから可能。
現状 cloud sqlのインポートは google storageにファイルを置かなければいえない。
また、次の2つの形式しか対応していない。
- csv
- sql

csvファイルでインポートするときに1行目をヘッダーとみなす設定がない
headerをなくしたcsvファイルをわざわざアップロードしないといけない

csvファイルでインポートするとき0から始まる文字列の0を詰めてしまう
0123456
とうデータがあったら123456
と解釈してしまう。これを避けるためには、現状sqlからダウンロードするしかない

ERROR: permission denied for table xxxx
というエラーがでる
GUI上でSQLからダウンロードしようとすると この場合、cloud shellから--user
オプションをつけてsqlインポートすると回避できる。
error: exit status 3 stderr: ERROR: permission denied for table xxxx If --clean was specified during export of the dump file being imported, a custom user must be specified during import with --user=; this user must own all objects in the specified database to allow for DROP commands (see https://cloud.google.com/sql/docs/postgres/import-export#troubleshooting-import).
こちらのページを参考にしてみてほしい
このスクラップは3ヶ月前にクローズされました