N
Neon2mo ago
national-gold

Its possible to reset the database from parent without copying the data from 1 table?

Has the title says, normally i reset my databases but include data that i dont need or want from production so i was thinking if its possible to just copy the tables that i want.
3 Replies
eager-peach
eager-peach2mo ago
Unfortunately, no. The reset from parent feature is performed on the branch, so it would reset all tables in the databases on that branch.
national-gold
national-goldOP2mo ago
Is there any other way to do this even if it involve a script? @Daniel ? If not thanks for the support!
eager-peach
eager-peach2mo ago
You could use pg_dump and to dump the desired tables and restore them to a database in a different branch (which could be a different branch in the same Neon project or a different Neon project). Here's an example. Make sure to use unpooled connection strings (you can copy them from the Neon Console). In this example, both branches have a database named neondb. Dump table1, table3, and table5 only from source db pg_dump "postgres://your_user:your_password@your_project_id.neon.tech/neondb?sslmode=require" \ --table=table1 \ --table=table3 \ --table=table5 \ --file=partial_dump.sql Restore into the target db psql "postgres://your_user:your_password@your_project_id.neon.tech/neondb?sslmode=require" < partial_dump.sql Confirm the restored tables on the target db psql "postgres://your_user:your_password@your_project_id.neon.tech/neondb?sslmode=require" -c "\dt" or just view the tables on the Tables page in the Neon Console

Did you find this page helpful?