This is really great - it only leaves the use case I outlined - updating rows from csv (or - in the case of UUID / name field of coupon, would this work that way anyway? Actually, I think so....)
On Sat, Mar 7, 2009 at 3:15 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > Actually if you restore multiple tables using > > d={} > db.table1.import_from_csv_file(file1,d) > db.table2.import_from_csv_file(file3,d) > ... > > web2py WILL FIX all your references. The new id will not be the same > as the old ones but the references will reflect the new ids. > This is achieved by storing a map between the original id and the new > id in the d={} dictionary. Give it a try. > > You can also import_to_csv_field and export_from_csv_file an entire db > (as opposed to an individual table) and the remapping of the ids is > the default behaviour. > > Massimo > > On Mar 7, 1:31 pm, Joe Barnhart <joe.barnh...@gmail.com> wrote: > > Well, what if I wanted to restore a database with ids used in multi- > > table links? From what I read of the "import csv" it discards the id > > field and inserts new records -- which will cause any linked records > > from other tables to break. Come to think of it, I'm not sure how you > > restore a database at all unless the ids can be set explicitly. > > > > At least this is one use case. > > > > -- Joe B. > > > > On Mar 5, 9:49 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > Why would anybody do such a thing? This can break the integrity of the > > > database. > > < > > > Massimo > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---