1

I need to convert a postgres file into sqlite3 database file. I already have data in popstgres db. This is related to Django-webapp. Is it possible and if yes, how?

2 Answers 2

0

First you need to make dump of current postgresql db. Either use pgAdmin (right click and backup) or pg_dump.

pg_dump --data-only --inserts YOUR_DB_NAME > dump.sql'

There could be possible also some modification, check convert pqsql to sqlite3

Remove the lines starting with SET

Remove the lines starting with SELECT pg_catalog.setval

Replace true for ‘t’

Replace false for ‘f’

in sqlite3

sqlite3 database_name
sqlite> .read 'path_to_dump.sql'
Sign up to request clarification or add additional context in comments.

1 Comment

Hi, thanks a lot. I am half way! created the dump.sql from pgadmin (selected data only and blobs-yes). WHile reading in sqlite3, it is showing syntax error: Error: near line 16: near "COPY": syntax error Error: near line 17: unrecognized token: "\" I seelines in the dump.sql as: COPY public ....... FROM stdin; \. Any ideas? Thanks though for a headstart!!
0

This is where I found my answer, as my problem was related to databases and django --> here.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.