Tony
Tony

Reputation: 10208

Import CSV to Heroku database

In a Rails application that is deployed to Heroku I need to import a CSV.

How Can I fill the tables in Heroku with that csv?

Upvotes: 2

Views: 4138

Answers (2)

Magne
Magne

Reputation: 17223

Importing a CSV dump of Postgres data into Heroku:

https://gist.github.com/jboesch/5605747

Upvotes: 1

Neil Middleton
Neil Middleton

Reputation: 22238

If you're talking about doing this programatically, a combination of FasterCSV (built into 1.9) and ActiveRecord are your best bet.

http://blog.pioneeringsoftware.co.uk/2010/07/13/import-csv-files-in-rails-3

If you're looking to push the CSV directly into Postgres then you need to make the file available for PG to see and then open the file from there.

http://www.postgresql.org/docs/8.2/static/sql-copy.html

Upvotes: 1

Related Questions