本文介绍了将csv导入英雄postgres的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我成功地部署了我的第一个Django / Heroku应用程序,现在我只需要传输我的数据库。之前在Win7 PC上的MySql数据库。我环顾四周,将csv导入Heroku数据库,但没有找到任何东西。他们建议使用ruby gem来执行,或使用 taps 和此命令:
heroku db:push mysql:// root:将mypass @本地/ mydb的
我的数据库很小,只有大约1000列和2个表,所以做它是很简单的导入CSV文件,但我无法找到如何做到这一点。任何人都知道?

解决方案

根据,您可以使用copy命令从本地文件系统中将CSV加载到postgres中。您应该可以使用这个与您的Heroku数据库与以下类似的东西:



PGPASSWORD = passwordhere psql -h主机名-U用户名dbname -c\copy ..


I succesfully deployed my first Django/Heroku app, and now I only need to transfer my database. It was previously on a MySql db on a Win7 PC. I looked around for ways to import csv into the Heroku db but didn't find anything. They suggest using a ruby gem to do it, or using taps and this command: heroku db:push mysql://root:mypass@localhost/mydb.My database is pretty small, only around 1000 columns and 2 tables, so it would be pretty simple to do it import the CSV files, but I cant find how to do it. Anyone knows?

解决方案

As per enter link description here, you can use the copy command to load a CSV into postgres from you local filesystem. You should be able to use this with your Heroku DB with something similar to:

PGPASSWORD=passwordhere psql -h hostname -U username dbname -c "\copy ..."

这篇关于将csv导入英雄postgres的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 10:45