[英]How can I download the Schema from a PostgreSQL db hosted on heroku?
I would like to create a ERM-Diagram from a PostgreSQL Database which is hosted on heroku. 我想从一个托管在heroku上的PostgreSQL数据库创建一个ERM-Diagram。 The database itself is almost 20 GB big, which makes downloading the whole dump not an option. 数据库本身几乎是20 GB,这使得下载整个转储不是一个选项。
Is there a way to simply backup and download the schema including foreign keys, and maybe 10 rows of each table in the database, which could subsequently be restored into a local dabase via the psql
-command? 有没有办法简单地备份和下载包含外键的模式,也可能是数据库中每个表的10行,随后可以通过psql
-command将其恢复为本地数据库?
I have the PG Backups Plus addon enabled, but that seems to only enable me to dump the whole database with the complete dataset. 我启用了PG Backups Plus插件,但这似乎只能让我使用完整的数据集转储整个数据库。
Use pg_dump instead. 请改用pg_dump。 The --schema-only|-s
option does just what you're looking for. --schema-only|-s
选项--schema-only|-s
您的需求。
pg_dump --schema-only -h host -U user -f schema_dump_file dbname
Then just manually grab a bit of data that you want. 然后只需手动抓取您想要的一些数据。 There's no easy way, that I know of or seen, around that. 我知道或看到的并没有简单的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.