RSS RSS feed | Atom Atom feed
Popular Articles: Tom Riddle's Magical Diary | AJAX Lego Robot | AJAX CAPTCHA | SQL Multisets

Exporting and Importing CSV files to Heroku postgresql

Export

On your local db console:
copy (select * from your_table where xyz) to '/tmp/rows.csv' With CSV;

Import

To import above rows to your heroku db, first make sure to do a backup
heroku pgbackups:capture --expire -a your_app
Then the actual import
psql `heroku config:get DATABASE_URL -a your_app`?ssl=true -c "\copy your_table FROM '/tmp/rows.csv' WITH CSV;"
slashdot digg del.icio.us technorati [more]




Add a comment Send a TrackBack