Following the advice in the book:

In web2py, you can backup/restore an entire database with two commands:

To export:

1.

>>> db.export_to_csv_file(open('somefile.csv', 'wb'))

To import:

1.

>>> db.import_from_csv_file(open('somefile.csv', 'rb'))


I found the following when restoring:

db.import_from_csv_file(open('/Users/js/Downloads/zenex_20110930.csv',
'rb'))
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/js/Programmeer/zenex/web2py/gluon/dal.py", line 4609, in
import_from_csv_file
    unique, *args, **kwargs)
  File "/Users/js/Programmeer/zenex/web2py/gluon/dal.py", line 5095, in
import_from_csv_file
    new_id = self.insert(**dict(items))
  File "/Users/js/Programmeer/zenex/web2py/gluon/dal.py", line 4976, in
insert
    return self._db._adapter.insert(self,self._listify(fields))
  File "/Users/js/Programmeer/zenex/web2py/gluon/dal.py", line 886, in
insert
    raise e
IntegrityError: insert or update on table "auth_membership" violates foreign
key constraint "auth_membership_user_id_fkey"
DETAIL:  Key (user_id)=(23) is not present in table "auth_user".

and this presents me with serious problems.  It seems that the only way to
be able to duplicate a database on a another server will be to use uuid's.

I have also tried a pg_dump of the whole database and pg_restore on the
other computer and all the cross references were messed up.

Regards
Johann

-- 
 May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord!  His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
                                                    2 Pet. 1:2b,3a

Reply via email to