Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dumpdata from django-tenant-schemas?

I am trying to use manage.py dumpdata on my app's model but I am not able to see the json data in my dump file as I am using the django-tenant-schemas app to manage models for various clients. Is there any solution to dumpdata related to specific schema?

like image 816
Shashishekhar Hasabnis Avatar asked Sep 06 '25 12:09

Shashishekhar Hasabnis


1 Answers

I found the solution to do so:-

python manage.py tenant_command dumpdata --schema="schema-name" app_name.model_name --indent 4 > fixtures/dump.json

Or you can use:-

for t in $(./manage.py list_tenants | cut -f1);
do
    ./manage.py tenant_command dumpdata --schema=$t --indent=2 auth.user > ${t}_users.json;
done

I found the answer here:-

http://django-tenant-schemas.readthedocs.io/en/latest/use.html?highlight=dumpdata

like image 106
Shashishekhar Hasabnis Avatar answered Sep 08 '25 12:09

Shashishekhar Hasabnis