I am importing data into an existing web2py application.  The tables
are connected - I'll pretend for the moment that they are the owners
and dogs tables from the web2py book.  I used the shell and typed in
the following commands (based on an example previously posted by
Massimo):

map = {}
db.owners.import_from_csv_file(open('<path>/owners.csv','r'),map)
db.dogs.import_from_csv_file(open('<path>/dogs.csv','r'),map)

The owners appeared correctly in the table, but when I tried to view
the dogs (through the admin database interface), I got an error that
the references were broken.  I had manually ensured that all dogs in
the dogs table had references to owners that were in the owners table
(i.e. no broken references in the data I uploaded), so the failure
occurred on the translation of ids on the upload.

Any ideas what I am doing wrong?  Has anyone successfully used the
this feature of the import_from_csv_file?

Thanks in advance for any ideas.


Reply via email to