Tracy S. Ruggles wrote:
> Was there a suggestion on how to deal with multiple databases with the
> same tables? I have an admin database that has content-related tables
> that periodically get "published" to the live database. I was
> wondering if anyone had a suggestion about how to re-use an SQLObject
> class definitions with multiple _connection objects.
I don't think this is possible with SQLObject. The "published" system
you mention seems
like a nightmare waiting to happen, having separate databases getting
their information from one source at any time.
Surely another safer way of doing this would be to have a client-server.
The server manages the main database and the clients go through it. The
clients at certain
times then ask the server for the latest changes via some control logic.
They would
get the changes and add them to their own databases.
Well thats my two cents,
all the best,
om
>
> --T
>
>
> On Wednesday, August 27, 2003, at 01:43 PM, Tracy S. Ruggles wrote:
>
>> Is there a better way to handle multiple connections of a single
>> table than this:
>>
>>> class mytable(SQLObject):
>>> _connection = localConnection
>>> name = StrCol(length=255)
>>> data = StrCol()
>>>
>>> localdata = mytable.select()
>>> # change connection
>>> mytable._connection = remoteConnection
>>> remotedata = mytable.select()
>>> # change it back...
>>> mytable._connection = localConnection
>>
>>
>> The object returned by the two different connections are actually
>> different objects and update properly through the right database
>> connection, but any related objects returned through a RelatedJoin
>> are the same, using the current connection. Is there a better way to
>> do this?
>>
>> I thought I might be able to do this:
>>
>>> class mytableRemote(mytable):
>>> _connection = remoteConnection
>>
>>
>> ...but it doesn't seem to work. Or, I thought I could just sub-class
>> SQLObject...
>>
>>> class mySQLObject(SQLObject):
>>> _connection = localConnection
>>> def connectRemotely(self):
>>> self.__class__._connection = remoteConnection
>>> def connectLocally(self):
>>> self.__class__._connection = localConnection
>>
>>
>> I know that I can duplicate my table definition modules and just give
>> each one a different connection object, but I want to be able to
>> re-use the class definitions...
>>
>> Thanks,
>> Tracy
>>
>>
>>
>> -------------------------------------------------------
>> This sf.net email is sponsored by:ThinkGeek
>> Welcome to geek heaven.
>> http://thinkgeek.com/sf
>> _______________________________________________
>> sqlobject-discuss mailing list
>> sql...@li...
>> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> sqlobject-discuss mailing list
> sql...@li...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
--
Oisin Mulvihill
Engines Of Creation
Email: oi...@en...
Work: +353 1 6791602
Mobile: +353 868191540
|