Re: Newbie questions

Sebastien Bigaret <[email protected]> Thu, 29 Apr 2004 22:13:39 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
    Hi Stephen,

Stephen Nesbitt <[email protected]>:
> All:
> 
> A couple of quick (I hope) newbie questions.
> 
> First what is the canonical way to override the the database access stuff 
> embedded in the model? Essentially I've modeled our production database, but
> want to validate and test against a test database without modifying the model
> 

I'd say the canonical way is to create a file, say, test_DB.cfg,
that overwrite the necessary db-connection dict.
(host, port, user, password)

Then set the env. variable MDL_DB_CONNECTIONS_CFG
to the full path of this .cfg file, and it will be automatically used
to overwrite the specified field with the associated values
just after the model is loaded.

See http://modeling.sourceforge.net/UserGuide/env-vars-core.html
for details.

However, please do some testing before trying to drop
the whole database!! --probably the best way to avoid shooting
yourself in the foot is to remove the user/password/host/port stuff
from your model, and have two deidacted db_config.cfg file, one on
the production machine, the other one on the test machine.
This way if you forget to set the env. variable you won't hit the
production db, just get some errors.

> Second, how do I handle commits and rollbacks? I had an instance were I had a
> failed transaction and ended up with a hung transaction and no obvious way to
> roll it back.
> 
> Thanks in advance!

Could you be more specific? Do you have an example? Normally
the framework does/should do all the commit or rollback stuff
for you, it shouldn't leave a opened transaction.

What do you mean exactly by a "hung transaction"?
(BTW: which db do you use?)

If this is a bug, we'd better be able to reproduce it to get rid of it :-/

-- Sébastien.



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click