How to dumpdata from django-tenant-schemas?

2.1k Views Asked by At

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?

1

There are 1 best solutions below

0
Shashishekhar Hasabnis On BEST ANSWER

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