django-admin.py dumpdata to SQL statements

元气小坏坏 提交于 2019-12-05 18:41:13

I suggest to use SQL-specific dump program (e.g. mysqldump for MySQL).

For sqlite embedded in Python, you can look this example not involving Django:

# Convert file existing_db.db to SQL dump file dump.sql
import sqlite3, os

con = sqlite3.connect('existing_db.db')
with open('dump.sql', 'w') as f:
    for line in con.iterdump():
        f.write('%s\n' % line)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!