How to debug appadmin CSV uploading

54 views
Skip to first unread message

Jon Subscripted

unread,
May 1, 2020, 6:57:38 AM5/1/20
to web...@googlegroups.com
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.

Libre de virus. www.avast.com

Clemens

unread,
May 1, 2020, 11:23:37 AM5/1/20
to web2py-users
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

Andrew Rogers

unread,
May 2, 2020, 1:10:16 AM5/2/20
to web2py-users
Can't help you Jon sorry. I tried to upload a while back but got a different issue (see https://groups.google.com/forum/#!topic/web2py/03-7xKAioD8)  So maybe that feature has fallen into disuse?

Jon Subscripted

unread,
May 8, 2020, 7:41:16 PM5/8/20
to web...@googlegroups.com
Thanks!

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/f7f07401-d033-4a7e-9273-79e3698050b2%40googlegroups.com.

Dave S

unread,
May 16, 2020, 9:17:54 PM5/16/20
to web2py-users


On Friday, May 8, 2020 at 12:41:16 PM UTC-7, Jonsubs wrote:
Thanks!

El El sáb, 2 may 2020 a las 3:10, Andrew Rogers <roge...@gmail.com> escribió:
Can't help you Jon sorry. I tried to upload a while back but got a different issue (see https://groups.google.com/forum/#!topic/web2py/03-7xKAioD8)  So maybe that feature has fallen into disuse?




For what it's worth, I have done plenty of CSV uploads from the admin pages (DB Mgt) but that has been mostly from 2.14.6 on my home system.
 
On a production system, when I switched from SQLite to Postgres, the CSV import was hundreds of thousands of rows, and I used the psql console.

/dps

On Friday, 1 May 2020 16:57:38 UTC+10, 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.

Libre de virus. www.avast.com

--
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 web...@googlegroups.com.

Jon Subscripted

unread,
Jun 13, 2020, 8:38:23 AM6/13/20
to web...@googlegroups.com
Thanks Dave!

To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/3812a283-94b3-458e-89fc-181a452d3028%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages