db.export_to_csv_file and type mismatch

38 views
Skip to first unread message

goome

unread,
May 21, 2015, 7:06:34 AM5/21/15
to web...@googlegroups.com
hello there is some way to export all the data (that have some type mismatch from modles/db definitions and real values present) and then reload cleaned?
i tried with db.export_to_csv_file but give me error :
ValueError: invalid literal for long() 
in fact, there are alues that should be double (o decimal) and that instedad are string (ex.: '27.0' for 27.0)
This cause runtime error
Any tips?

Dave S

unread,
May 21, 2015, 1:45:37 PM5/21/15
to web...@googlegroups.com

You  may need to use the DB's export tools, rather than the ones in web2py. 

Are you using sqlite?  There are mentions in the the forum archives that sqlite is "looser" in enforcing value typing than MySQL or PostGREs.  But exporting from sqlite  only requires that you open its shell, make sure the options are set right (like ',' as the separator for delimiter-separated values (CSV, for short)).  Options are accessed with the dot-commands (.help to start with), and then either .dump or a SELECT statement.

Some of the non-SQL DBs may allow mixing types, but I don't know how to dump those.  Their tools should have some documentation, though.

/dps



 

Ron Chatterjee

unread,
May 21, 2015, 3:41:13 PM5/21/15
to web...@googlegroups.com
There is a extract tool in script folder. I couldn't get it to work but if you do, please share:-)
Reply all
Reply to author
Forward
0 new messages