Hi Jon,

I prefer to upload csv files to the database via the python console, 
starting it as follows:
python *<path_to_your_web2py_installation>*/web2py.py -S *<your_app_name>* 
-M -P

There you can import the csv as follows (assuming your database is 
reference by db, i.e. db = DAL(...)):
filename = *<path_to_your_csv>*/*<your_file_name>*.csv'; print(filename)

*python2:*
db.import_from_csv_file(open(filename, 'rb')); db.commit()

*python3:*
db.import_from_csv_file(open(str(filename), 'r', encoding='utf-8')); 
db.commit()

To empty an existing database I do it the same way as follows:
for table_name in db.tables():
>>> db[table_name].drop()

db.commit()

Hope it helps!

Regards
Clemens


On Friday, May 1, 2020 at 8:57:38 AM UTC+2, Jonsubs wrote:
>
> Hi everyone,
> I'm trying to upload a CSV file to my MySQL database using appadmin.
>
> I do get a "data uploaded" flash message as if I succeeded, but data is 
> not there.
>
> Could anyone suggest me how to debug this operation?
> Thanks, Jon.
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>  Libre 
> de virus. www.avast.com 
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>  
> <#CAK8tz31FLL14iggF+geUS_piGUFSmjKQV7ie34f=7OeQBFRh3Q@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2f6897b9-51fc-4765-8893-30a736e6ba51%40googlegroups.com.

Reply via email to