Quite right, restoring from, let's say, native mysql dump to postgresql 
would most certainly not work. That's exactly why web2py uses csv as the 
export format.

I don't think exporting / importing to csv is really recommended over using 
the native export / import functionality of your database engine or a 
specialized backup software (depending on your needs). But it works and it 
quickly covers the most broad spectrum possible. For anything more specific 
or complex, it's up to the developer to use something else. I don't think 
web2py should try to reinvent the wheel here.

If export to csv failed in your case, what exactly was the problem? The 
referenced thread is from 2011 and seems to be case specific... Are you 
saying you have the same exact error?

Regards,
Ales


On Thursday, March 21, 2013 11:12:57 AM UTC+1, dederocks wrote:
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to