I tried these:

Exported into csv file from appadmin interface three tables:
auth_user, allot, product
with allot(auth_user_id, product_id) having id's of user and product

Then tried to import 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='')

On importing, allot table isn't getting updated id's of auth_user &
allot.

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.


Reply via email to