csv import export

24 views
Skip to first unread message

Reza Shah

unread,
Apr 16, 2013, 8:02:09 AM4/16/13
to web...@googlegroups.com
Hi

I want to try import some data to certain table, my database is the default one(sqlite).
Since i don't now what kind of information i should put in the csv file, i inserted some data using admin interface, then exported to csv file.
Then i removed all the data in the target table then reimport using the csv file, but the result were only None for whole fields, only the id field was incremented

These are my sample data.

prefecture.id prefecture.name prefecture.name_en prefecture.name_kana
1 北海道 Hokkaido ほっかいどう
2 青森県 Aomori あおもり

My table definition:
db.define_table('prefecture',
    Field('name', unique=True),
    Field('name_en', unique=True),
    Field('name_kana', unique=True),
    format='%(name)s')


Result:
prefecture.idprefecture.nameprefecture.name_enprefecture.name_kana
1NoneNone
None
2None
None
None

Did i miss something?

Regards,
Reza 

Reza Shah

unread,
Apr 19, 2013, 8:12:31 PM4/19/13
to web...@googlegroups.com
I just found out there was a mistake in the csv file i used when importing.
The problem was i open the csv exported from admin in libreoffice, 
but i didnot notice that the separator converted to tab.

Reply all
Reply to author
Forward
0 new messages