I put following code to a function in controller an ran it:

    db.export_to_csv_file(open('f7bkp','w'))
    for table in db.tables: db[table].truncate()
    db.import_from_csv_file(open('f7bkp','r'))

export OK, drop tables OK, but import gave me:
File
"/home/julo/+/kubler/factor7/web2py/applications/factor7/controllers/ware.py", 
line 37, in receive
    db.import_from_csv_file(open('f7bkp','r'))
  File "/home/julo/+/kubler/factor7/web2py/gluon/sql.py", line 651, in
import_from_csv_file
    line=ifile.readline()
ValueError: Mixing iteration and read methods would lose data

In my model I did one change before, which was not reflected in my
sqlite database (expected behavior?). I have changed invoice.invoice_nr
from default type to integer. That was the reason for reloading of the
database. I hoped to get back changed database without data loss.
Here is the table:

TABLE invoice
invoice.id,invoice.invoice_nr,invoice.date,invoice.customer_id,invoice.issue_date,invoice.delivery_date,invoice.maturity_date,invoice.advance_pay,invoice.skonto
1,1,2009-01-10,1,2009-01-11,2009-01-14,2009-01-30,1000.0,3.0
2,2,2009-01-14,2,2009-01-15,2009-01-17,2009-01-20,15.0,2.0
3,3,2009-01-16,1,2009-01-18,2009-01-19,2009-01-29,0.0,3.0
4,4,2009-01-17,2,2009-01-18,2009-01-20,2009-01-30,15.0,0.0
6,5,2009-01-17,2,2009-01-19,2009-01-20,2009-01-21,0.0,5.0
7,6,2009-01-17,1,2009-01-19,2009-01-21,2009-01-28,0.0,0.0
8,7,2009-01-28,2,2009-01-28,2009-01-30,2009-02-02,100.0,0.0

I believe this was not the reason for failure as that column contains
just integer values and none of the tables were imported.

What could be the reason for import failure?
If needed I can provide you with the complete exported file and model.
Julius Minka


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to