I am using import csv option to insert records in the database. When I use 
the csv file from the web application, then  a single record is inserted in 
the database with all the records being updated properly as per the headers.

But If I try to use "import_from_csv_file" outside the web2py, it inserts 
multiple records in the database. This seems to be an bug to me.

Code for updating db outside web2py

libraryPath = r'D:\web2py'
dbPath = r'D:\web2py\applications\testapp\databases'

import sys
sys.path.append(libraryPath)
from gluon import DAL
db = DAL('sqlite://storage.sqlite',folder=dbPath,auto_import=True)
table = db['person']
file = r'D:\file.csv'
table.import_from_csv_file(file)
db.commit()

On using the same file (csv file) using the web2py, it works as expected, 
code :-

file = request.vars.csvfile.file
table.import_from_csv_file(file)

Can some one please comment on this behavior, what am I missing here?

-Sarbjit

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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