Question

I have a local (dev) database that I just populated with data by importing a .csv file. I have an empty (prod) remote database on Heroku that I would like to populate with the same data. Both databases are postgres and are completely identical in terms of their schema. I would think this would be an easy operation, but I have not found an answer on how to do this.

One thing I tried was:

heroku db:push

But then I got the error:

Taps Load Error: no such file to load -- sqlite3
You may need to install or update the taps gem to use db commands.

I updated taps only to get the same error. Can someone either tell me how to copy the data from my local db to my remote db or how to push the .csv file to my remote server and then I can upload it on the psql line from there?

Was it helpful?

Solution

Been long time I haven't use django. You can try this:
Put your csv file in app/sql directory.
If for example your csv file is for a model named mymodel,
you create mymodel.sql inside that directory and inside that sql file is your sql statement to input data from csv.

And then when you invoke

heroku python manage.py syncdb
those *.sql files should be executed by django.

More info: https://docs.djangoproject.com/en/dev/howto/initial-data/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top