On 28 Giu, 15:18, Avik Basu <avikb...@gmail.com> wrote:
> My problem is that I have some different tables in each of the
> databases which is why I could not use the db export/import
> functions.  Also, I am not defining tables in db2 as those tables
> already exist and have data in them. Am I still able to access the
> database function if i have not defined any tables for it in the
> model?

No. You have to define table tables you want to use since it is
necessary map database types into web2py types. You do not need to
define all fields, only those you plan to access. Set migrate=False.

>
> Avik
>
> On Jun 28, 4:06 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > import cStringIO
> > s=cStringIO.StringIO()
>
> > after the same tables are defined for both dbs:
>
> > db2.export_to_csv_file(s)
> > s.seek(0)
> > db1.import_form_csv_file(s)
>
> > On 28 Giu, 13:25, Avik Basu <avikb...@gmail.com> wrote:
>
> > > Hi,
>
> > > I'm trying to synchronize two databases that are similar but not
> > > exactly the same.  I would like to create two connections (db1 and
> > > db2) and go through table by table to do the synchronization.
>
> > > db1 = DAL('sqlite://storage.db')
> > > db2 = DAL('mysql://username:passw...@mysql.test.com/test_db',
> > > pool_size=10, check_reserved=['mysql'], migrate=False,
> > > fake_migrate=False)
>
> > > db1 is defined in db.py while db2 is a mysql database (created via
> > > web2py) that already exists and has data in it.  i'm trying to update
> > > the data in db2 with the data in db1.  What is a good way to deal with
> > > this problem?
>
> > > Avik

Reply via email to