Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rname support for import_from_csv_file #55

Open
ilvalle opened this issue Feb 8, 2015 · 0 comments
Open

rname support for import_from_csv_file #55

ilvalle opened this issue Feb 8, 2015 · 0 comments

Comments

@ilvalle
Copy link
Contributor

ilvalle commented Feb 8, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants