No Broken references I deleted all my DB and created a new one with only One auth_user, One product in Product Table and only One entry in Allot Table.
Not Exporting entire DB I'm not exporting entire DB, I'm exporting only three tables auth_user, product, allot and then I'm deleting only those three tables from **appadmin interface**. Importing: id_map = {} db.auth_user.import_from_csv_file(open('db_auth_user.csv'), id_map = id_map) db.allot.import_from_csv_file(open('db_allot.csv'), id_map = id_map) db.product.import_from_csv_file(open('db_product.csv'), id_map = id_map) Tried These methods Also: Export using: db.export_to_csv_file(open('backupfile.csv','wb')) Then delete all tables, make user to logout because while importing similar records are showing up twice. Import using: id_map = {} db(db.auth_user.id > 0).delete() db.import_from_csv_file(open('backupfile.csv','rb')) In this process also, I'm not getting updated id's in allot table ... allot (product.id, auth_user.id) --- Varun On Nov 26, 11:39 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > Not sure I understand. Do you get broken references? > > Are you exporting the entire db? and you importing over the existing > db or a clean db? > > Have you tried exporting and importing the entire db? > > db.export_to_csv_file(...) > db.import_from_csv_file(...) > > On Nov 26, 12:16 pm, vvk <varunk.ap...@gmail.com> wrote: > > > > > I tried: > > > Exported to csv file from appadmin interface, tables auth_user, > > product, allot with allot table having id references of auth_user and > > product > > allot(auth_user.id,product.id) > > > Imported as: > > > @auth.requires_login() > > def backup(): > > id_map = {} > > db.auth_user.import_from_csv_file(open('db_auth_user.csv'), id_map = > > id_map) > > db.allot.import_from_csv_file(open('db_allot.csv'), id_map = id_map) > > db.product.import_from_csv_file(open('db_product.csv'), id_map = > > id_map) > > redirect(URL(r=request,f='index')) > > return dict(form='') > > > After importing, allot table doesn't have updated id's of auth_user > > and product. > > > -------- > > Varun > > > On Nov 26, 9:34 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > You do not need uuid unless you want to import records that you > > > already have and want to replace them. > > > > If you use > > > > id_map={} > > > db.table1.import_from_csv_file(ifile1, id_map=id_map) > > > db.table2.import_from_csv_file(ifile2, id_map=id_map) > > > > the id_map={} makes sure all references between table1 and table2 are > > > preserved. References to records that are not imported may still be > > > broken. > > > > Massimo > > > > On Nov 26, 9:11 am, vvk <varunk.ap...@gmail.com> wrote: > > > > > I've created database and wrote controllers without using UUID's. > > > > While exporting and importing databases, I'm facing these problems > > > > > i) record id's are getting changed while importing and my search > > > > functions are no longer working because I've reference of id's of > > > > other tables, which are changing > > > > > example: > > > > db1(product) > > > > db2(db1.id,person) > > > > > I've read in Manual that UUID's should be used to reference rather > > > > than Id's. So should I change all my search functions also to search > > > > by uuid and not by id? > > > > > ii) How to modify entire existing database to have UUID's apart from > > > > changing model ? I don't want to recreate entire database. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@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.