0

Is there a way to export an existing table from postgresql database to a new table in a new sqlite3 database ?

I have a table named table1 in a postgres db named db1 - need to export the table to a new sqlite3 db named db2 and table named table2.

user3206440
  • 4,749
  • 15
  • 75
  • 132
  • Possible duplicate of [How to convert a postgres database to sqlite](https://stackoverflow.com/questions/6148421/how-to-convert-a-postgres-database-to-sqlite) – Roger Ng Nov 19 '17 at 12:45
  • that question is around converting a postgres DB to sqlite DB - the question here about exporting a single table from a postgres DB – user3206440 Nov 19 '17 at 12:50
  • That's pretty much the same. Add the `-t table1` in `pg_dump` command to export only that table. – Roger Ng Nov 19 '17 at 12:58
  • could you please add a reference for this ? – user3206440 Nov 20 '17 at 02:42
  • Execute the command `pg_dump --create --inserts -f export.sql -d db1 -t table1 -U myUserName -W myPassword` to export. Find and replace from `table1` to `table2` in the SQL file. – Roger Ng Nov 20 '17 at 05:55

0 Answers0