[Django]-How to dumpdata from django-tenant-schemas?

4👍

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

Leave a comment