从Heroku拉取数据的方法
确认插件
$heroku addons
Owning App Add-on Plan Price State
───────────────────── ─────────────────────────── ─────────────────────────── ───── ───────
evening-XXXX-VVVV postgresql-TTTTT-VVVVV heroku-postgresql:hobby-dev free created
确认数据库
$heroku pg:info -a evening-XXXX-VVVV
=== DATABASE_URL
Plan: Hobby-dev
Status: Available
Connections: 0/20
PG Version: 12.6
Created: 2021-01-19 16:00 UTC
Data Size: 9.2 MB
Tables: 17
Rows: 1/10000 (In compliance)
Fork/Follow: Unsupported
Rollback: Unsupported
Continuous Protection: Off
Add-on: postgresql-TTTTT-VVVVV
抓取数据
$PGUSER=username PGPASSWORD=password heroku pg:pull postgresql-TTTTT-VVVVV localdb_development -a evening-XXXX-VVVV
将数据推送
$heroku pg:reset -a evening-XXXX-VVVV
$PGUSER=username PGPASSWORD=password heroku pg:push localdb_development postgresql-TTTTT-VVVVV -a evening-XXXX-VVVV
附加品
从Postgres导出数据
psql -c "\copy table to 'sample.csv' delimiter ',' header;"
数据输入
psql -c "\copy table from 'sample.csv' delimiter ',' header;"