使用postgres从heroku中提取数据

时间:2014-12-20 15:10:45

标签: node.js postgresql heroku

我正在使用this heroku walkthrough开始使用node.js。我已经走到了尽头,现在我想将数据从远程数据库拉到我的本地版本。

我刚刚按照here说明运行了$ heroku pg:pull HEROKU_POSTGRESQL_[mycolor] mylocaldb --app [myappname],并且返回了大量pg_dumppg_restore条消息。

pg_dump: reading schemas
pg_dump: reading user-defined tables
pg_dump: reading extensions
pg_dump: reading user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user-defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading user-defined operator classes
pg_dump: reading user-defined operator families
pg_dump: reading user-defined text search parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_dump: reading user-defined text search configurations
pg_dump: reading user-defined foreign-data wrappers
pg_dump: reading user-defined foreign servers
pg_dump: reading default privileges
pg_dump: reading user-defined collations
pg_dump: reading user-defined conversions
pg_dump: reading type casts
pg_dump: reading table inheritance information
pg_dump: reading event triggers
pg_dump: finding extension members
pg_dump: finding inheritance relationships
pg_dump: reading column info for interesting tables
pg_dump: finding the columns and types of table "test_table"
pg_dump: flagging inherited columns in subtables
pg_dump: reading indexes
pg_dump: reading constraints
pg_dump: reading triggers
pg_dump: reading rewrite rules
pg_dump: reading large objects
pg_dump: reading dependency data
pg_dump: saving encoding = UTF8
pg_dump: saving standard_conforming_strings = on
pg_dump: saving database definition
pg_dump: dumping contents of table test_table
pg_restore: connecting to database for restore
pg_restore: creating SCHEMA public
pg_restore: creating COMMENT SCHEMA public
pg_restore: creating EXTENSION plpgsql
pg_restore: creating COMMENT EXTENSION plpgsql
pg_restore: creating TABLE test_table
pg_restore: processing data for table "test_table"
pg_restore: setting owner and privileges for DATABASE dfm6qsm6f0l9kh
pg_restore: setting owner and privileges for SCHEMA public
pg_restore: setting owner and privileges for COMMENT SCHEMA public
pg_restore: setting owner and privileges for EXTENSION plpgsql
pg_restore: setting owner and privileges for COMMENT EXTENSION plpgsql
pg_restore: setting owner and privileges for TABLE test_table
pg_restore: setting owner and privileges for TABLE DATA test_table

现在当我访问/ db路由时,我仍然收到此错误消息:

Error error: relation "test_table" does not exist

我还需要做些什么才能正确地提取这些数据?

1 个答案:

答案 0 :(得分:0)

我只是从我的本地应用程序访问远程Heroku Postgres数据库,我认为,正如Heroku所说,FWIW。但我收集的是,Heroku没有正确地做某事。我这样破解了我的设置:

Trouble Accessing Remote Postgres DB on Heroku from Local Node.js Webapp

鉴于其他帖子已经表明,我不确定这是最好的长期解决方案,但我没有问题。