I'm concerned with the lack of reliability and speed of the recommended
backup / restore functions: db.export_to_csv_file and
db.import_from_csv_file.
They failed in my case, and apparently I'm not alone
(https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/reOzXobYNgE).
Would it be wise to replace the backup function with something like:
import os
if 'sqlite' in db._uri:
os.system(' '.join(('sqlite3',db.path,'.dump >',targetfile)))
elif 'postgres' in db._uri:
os.system(' '.join(('pg_dump -f',targetfile, dbname)))
elif 'mysql' in db._uri:
os.system(' '.join(('mysqldump -r',targetfile, dbname)))
and similarly the restore function would be:
import os
if 'sqlite' in db._uri:
os.system(' '.join(('sqlite3',db.path,'<',sourcefile)))
elif 'postgres' in db._uri:
os.system(' '.join(('pg_restore -d',dbname, sourcefile)))
elif 'mysql' in db._uri:
os.system(' '.join(('mysqlimport',dbname, sourcefile)))
Unfortunately I'm not knowlegable enough (yet) about all the various
databases supported nor about platform-dependent intricacies, but would
this not be a more reliable approach?
The only major downside is that restoring a db from x (say sqlite) into y
(say postgresql) might not be possible, or require some significant edit of
the dump file. And to make the restore smoother, you'd have to figure out
the source format -- is this possible?
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.