Quoting Oleg Broytmann <[EMAIL PROTECTED]>:

 > > On Thu, Aug 24, 2006 at 09:30:42AM +1000, Ray Smith wrote:
 >> >> Is it possible to connect to 2 databases each of which have a common
 >> >> table name??
 > >
 > >    It is. I have a program that copies a database from Postgres to 
SQLite =
-
 > > both backends have identical structures.
 > >    Just pass a connection object to an every method.

Hi Oleg,

Sorry, as usual I didn't explain my problem fully  :(   ...

The problem is both databases "don't" have identical structures.

The second import fails with:

-----------------
ValueError: class Test is already in the registry (other class is
<class 'import1.Test'>, from the module import1 in
D:\\tmp\\import1.py; attempted new class is <class
'import2.Test'>, from the module import2 in
D:\\tmp\\import2.pyc)
-----------------

What I'm trying to do is write a conversion program that converts
my database from say a "1.0" version to a "2.0" version.

My current idea is to import the new and old schema (i.e. import1.py
and import2.py) - they will be different.
Create the the new database, read the old database inserting into the
new one making appropriate data changes.

(I'm using SQLite - so no schema modification is supported)

Any help appreciated,

Thanks,

Ray


#
# test sqlobject for 2 databases with same table name
#

from sqlobject import *
import os

import import1
import import2


if os.path.exists('c:\\test1.db'):
    os.unlink('c:\\test1.db')
con1=connectionForURI('sqlite:/c|/test1.db')

if os.path.exists('c:\\test2.db'):
    os.unlink('c:\\test2.db')
con2=connectionForURI('sqlite:/c|/test2.db')


import_test1.Test.createTable(connection=con1)
import_test2.Test.createTable(connection=con2)


con1.close()
con2.close()




# import1.py
from sqlobject import *

class Test(SQLObject):
    desc=StringCol()





# import2.py
from sqlobject import *

class Test(SQLObject):
    desc=StringCol()
    newcolumn=StringCol()

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to