Migrating from sqllite3 to postgres

33 views
Skip to first unread message

jaspinder singh

unread,
May 22, 2015, 2:19:35 AM5/22/15
to django...@googlegroups.com
I have developed an app using sqllite. But my Heroku doesn't support sqllite and the data keeps leaking every 24 hours. Can someone list the steps how to change from sqllite3 to postgres

Gergely Polonkai

unread,
May 22, 2015, 4:59:46 AM5/22/15
to django...@googlegroups.com

I will also have to do this in the near future (same reason), and already have some untested ideas. My guess is to add a second database in settings.DATABASES, fetch all the model instances from my original db and save them in the other. But if anyone has a better solution, let us know!

On 22 May 2015 09:19, "jaspinder singh" <jaspinde...@gmail.com> wrote:
I have developed an app using sqllite. But my Heroku doesn't support sqllite and the data keeps leaking every 24 hours. Can someone list the steps how to change from sqllite3 to postgres

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7fc71178-9609-42c2-8c39-e6c5d132ffdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Babatunde Akinyanmi

unread,
May 23, 2015, 8:28:21 AM5/23/15
to Django users

Or
Create a new postgres database, transfer the data to it, verify its correctness then change your settings file to point to the postgres database.

Peter of the Norse

unread,
May 25, 2015, 10:46:05 AM5/25/15
to django...@googlegroups.com

> On May 21, 2015, at 11:24 PM, jaspinder singh <jaspinde...@gmail.com> wrote:
>
> I have developed an app using sqllite. But my Heroku doesn't support sqllite and the data keeps leaking every 24 hours. Can someone list the steps how to change from sqllite3 to postgres
>


From sqlite:
sqlite> .output backup.sql
sqlite> .dump

From the command line:
$ psql django_db -1f backup.sql

You may have to edit the .sql file to make it work. Good luck.

Peter of the Norse
Rahm...@Radio1190.org



Luis Zárate

unread,
May 25, 2015, 6:24:24 PM5/25/15
to django...@googlegroups.com
Mmm probably you are looking for export /import data in django.

For export :
python manage.py dumpdata --format=json myapp > data.json

For import:
python manage.py loaddata data.json

See

https://docs.djangoproject.com/en/1.8/ref/django-admin/#loaddata-fixture-fixture
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/53FD5433-F4CA-4684-9BF5-E9FA4EA786C4%40Radio1190.org.

> For more options, visit https://groups.google.com/d/optout.
>

--
"La utopía sirve para caminar" Fernando Birri



Reply all
Reply to author
Forward
0 new messages