Export the Heroku Postgres database, but exclude the table

I want to get an export of my Heroku Postgres database, however I want to exclude one table. Is it possible?

Here is the command I use to export my entire Postgres database:

$ PGUSER=my_username PGPASSWORD=my_password heroku pg:pull DATABASE_URL my-application-name`

Maybe there is a way to exclude one table or specify a list of tables to include?

+4
source share
2 answers

In the regular pg dump command, you can specify the tables to include with the -t option and exclude tables with the -T option.

Can you try this:

$  PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -T *table you want to exclude* -h localhost -U myuser mydb > mydb.dump
+1
source

Here is a document copied from an official postgreql document.

-T table
--exclude-table = table

, . , -t. -T , , .

-t -T, , , -t, -T. -T -t, , -T, , .


http://www.postgresql.org/docs/9.1/static/app-pgdump.html

0

Source: https://habr.com/ru/post/1611681/


All Articles