I have the same situation here. But, I've taken a totally different
approach. We have an ERP system running on an AS/400. I have LOTs of
other little apps that access data (mostly order and sales history info)
from the ERP system. Instead of dealing with the AS/400 database and
two db's in TurboGears, I have written synchronization scripts that run
nightly to grab data off the production AS/400 and bring it in to my
MySQL database. This works for me because for my needs, day old data is
acceptable. The other added benefit is that I can now dictate what the
model looks like and can make it play nice with SQLObject. The
synchronization scripts are not difficult to write. Also, I've been
playing with another open source tool called JitterBit which will do the
whole thing for you if you have a server you can spare for it.
I don't know if this will work in your environment, but this is the way
I was able to implement the same kind of thing. Also, I haven't tried
it, but does SQLObject work with Interbase? I thought there were only a
few databases supported.
-Jim
Johnny Blonde wrote:
> Hello Felix,
>
> thanks a lot for your nice comment.
>
> i had no time yet to try your tip, but i have few questions on it:
>
> the connection to the legacy is established automatically?
> what happens when i "tg-admin sql create"? is the legacy model
> processed as well? (i don“t want it to be processed)
> how can i lateron access the legacy-model within the app? - i have to
> import myapp.legacy in order to access it?
>
> i now have something like this:
> =========================================================
> =========================================================
> from datetime import datetime
> from turbogears.database import PackageHub
> from sqlobject import *
>
> hub = PackageHub("myapp.legacy")
> __connection__ = hub
>
> class Teilnehmer(SQLObject):
> class sqlmeta:
> fromDatabase=True
> idName="NR"
> =========================================================
> =========================================================
>
> should it work like this?
>
> Regards,
> Frank
>
> On 26 Feb., 13:58, Felix Schwarz <[EMAIL PROTECTED]> wrote:
>
>> Johnny Blonde schrieb:> I need to develop an app, with something "special":
>>
>>
>>> I have one legacy database of our main booking software, interbase
>>> actually, that i need to access. i am definately not allowed to
>>> write/modeify data in it, so it has to be strictly read only. the
>>> model, of course, is given within the database.
>>>
>> >
>> > for the app itself to save something i need a second database
>>
>> Had the same situation here and TurboGears provides some very nice
>> mechanisms to
>> handle it. Just split your model into two different packages and use
>> turbogears.database.PackageHub.
>>
>> For example:
>> ---------
>> legacy.py
>> __connection__ = turbogears.database.PackageHub("myapp.legacy")
>> (my legacy model)
>> ---------
>> model.py
>> hub = PackageHub("quarantine")
>> __connection__ = hub
>> (your app model)
>>
>> Use the configuration system to define different credentials:
>> sqlobject.dburi = "mysql://foo:[EMAIL PROTECTED]/mydb"
>> myapp.legacy.dburi = "mysql://bar:[EMAIL PROTECTED]/xams"
>>
>>
>>> would i have two separate models for each database?
>>>
>> yes.
>>
>> fs
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---