Yu Tian Toby
Yu Tian Toby

Reputation: 419

How to export Postgres schema/data to plain SQL in PgAdmin 4

I read a few similar posts and find that they did not specify how to export SQLs to custom files. I will walk through steps with screenshots here.

reference reference

Upvotes: 9

Views: 31695

Answers (3)

C. Alex
C. Alex

Reputation: 84

Neither of the other solutions on this post are what I needed.

To generate all of my tables' creation SQL, I prefer the method of:

1: Right click on Schema field in left panel, select "Create ERD for Schema"

Right Click on Schema, Select "Create ERD For Schema"

2: At top of right panel, "Generate SQL".

Alt+Ctrl+S

Upvotes: 4

Saša Kalaba
Saša Kalaba

Reputation: 4411

There is a Store Manager under Tools that allows you to download a backup explained in the answer above. Took me a while to find it. Hope this helps.

enter image description here

enter image description here

Upvotes: 2

Yu Tian Toby
Yu Tian Toby

Reputation: 419

  1. right click on a table/schema/database and click 'Backup' in the menu.

enter image description here

  1. set export file format to 'Plain'

enter image description here

  1. select the custom file created to save the backup scripts

enter image description here

and double click to confirm

enter image description here

  1. open 'dump options' tab to set dump options

enter image description here

  1. set dump options

enter image description here

enter image description here

  1. set 'Use INSERT commands' so the exported sql is runnable when original table/schema/database is deleted

enter image description here

  1. click 'Backup' button to start process

enter image description here

  1. PgAdmin shows success message when backup is done

enter image description here

Upvotes: 19

Related Questions