Re: [Modeling-users] Roadmap to 0.9 - connectionDictionary
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-05-07 11:39:32
|
Hi, Mario Ruggier <ma...@ru...> writes: [...] > > I suggest a env. variable poiting to a specific init-file read by > > ConfigParser and changing the models' connection dictionary when they > > are loaded --see tests.utils.parseConfigFile_and_updateModel() and > > tests/test.cfg for an example of this technique. > > > > Does it sound reasonable? This can be easily done, and it will meet > > the exact requirements you're pointing out. I guess we can make it > > happen for 0.9. >=20 > Would be wonderful way to go. This case will also make encrypting > of password less necessary. Okay, this is now available from the main trunk in CVS, will be in next release. Usage: set the environment variable MDL_DB_CONNECTIONS_CFG to the path of a configuration file, say /full/path/to/mydbconf.cfg This is an ini-like file, parsed by ConfigParser, like: --------------- [DEFAULT] host: localhost =20=20=20=20 [ModelName_1] user: user_1 password: pwd_1 =20=20=20=20 [ModelName_2] adaptor: MySQL user: user_2 password: pwd_2 --------------- Now you can remove the user & password from your model (ie the .xml/.py/ pickled one), and instead put them in a single file. The special field 'adaptor' can be used to override the model's adaptorName. Last, it is an error to set this env.var. when the file does not exist. Enjoy! Cheers, -- S=E9bastien. |