Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django on Heroku dumpdata incomplete output

I've been trying to dump a relatively small amount of data (80 rows or so of django-cms text plugin1) remotely via Heroku toolbelt:

heroku run python manage.py dumpdata text

But I get random incomplete output that gets closer to EOF every run (presumably cached?).

11:09 PM $> heroku run python manage.py dumpdata text | wc -c
108351
11:09 PM $> !!
120629
11:09 PM $> !!
122693
11:10 PM $> !!
122949
11:10 PM $> !!
153419
11:13 PM $> !!
120877

Anyone run into something similar? I'm using Django 1.4 with postgresql.

1 although, it is blobs of HTML o_0: see docs.

Edit: assume this is just a limitation?? pg_dump's/ restore was my "backup" plan.

like image 563
adm Avatar asked Sep 24 '12 22:09

adm


3 Answers

Yet another workaround is to add a sleep command to stop the session timing out.

heroku run "python manage.py dumpdata; sleep 10"

Presumably the number grows along with your database...

like image 51
user2718528 Avatar answered Nov 16 '22 10:11

user2718528


Looks like for some reason the script times out. This is either a bug or a "feature" on Heroku's part. Here is a workaround:

https://devcenter.heroku.com/articles/heroku-postgres-import-export

like image 38
markshiz Avatar answered Nov 16 '22 09:11

markshiz


Another simpler workaround is to run dumpdata from within a heroku bash prompt:

heroku run bash

python manage.py dumpdata ...

Then capture the output from your terminal. Copy and paste worked for me. I'm sure there's a fancier way to do this.

like image 2
Jesse Avatar answered Nov 16 '22 11:11

Jesse