Skip to content

rname support for import_from_csv_file  #55

Open
@ilvalle

Description

@ilvalle

I'd import a csv containing real database field name (dumped outside web2py).

db.define_table('test_1',
    Field('name', rname='firstname'))
import os
file_path = os.path.join(request.folder, 'test_1.csv')
db.test_1.import_from_csv_file(open(file_path, 'r'))
print db(db.test_1).select()
test_1.id,test_1.name
1,<NULL>
2,<NULL>

The content of test_1.csv is

"firstname"
Paolo
Luca

Without explicitly map the field names rname is not supported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions