Home | Trees | Index | Help |
|
---|
Package aquarium :: Package database :: Module QuickSwitchDatabaseAssistant :: Class QuickSwitchDatabaseAssistant |
|
AquariumClass
--+ |AutoLoader
--+ |DatabaseAssistant
--+ | QuickSwitchDatabaseAssistant
Permit RDBM toggling.
This database assistant class permits a developer to develop for a range of RDBM's and then choose which one to use based on a properties file configuration.
If you have not read the rather lengthy and helpful comment in the aquarium.database.DatabaseAssistant class, please do so before reading this. Afterall, this is a relatively simple subclass of DatabaseAssistant.
The idea is as follows: go to your copy of site-packages/database and make a new directory for each RDBM you wish to support (for instance, mkdir mysql; mkdir sqlserver). Then, inside each directory, add a new __init__.py file (you can copy the one from $PYTHON_INSTALL_PATH/lib/python2.*/site-packages/aquarium/database provided you change the packageType appropriate, e.g. "database/mysql" or "database/sqlserver"). Now you have a place to put different "table classes" for your different RDBM's. Now, go edit your AquariumProperties file (there will be appropriate instructions there). By editing your AquariumProperties file, you can quickly switch between your different table classes (and thusly, different RDBM's).
Method Summary | |
---|---|
Tell AutoLoader what type of modules to autoload. | |
Inherited from DatabaseAssistant | |
Initialize private variables. | |
Rollback anything uncommitted. | |
Close the connection do the database. | |
Commit the current transaction. | |
Connect to the database. | |
Get a cursor object. | |
Fetch all rows and return a list of dicts. | |
This is a generator for fetching all rows as dicts. | |
Fetch one row as a dict. | |
Rollback the current transaction. | |
Inherited from AutoLoader | |
Import, instantiate, and return the desired instance. |
Method Details |
---|
getModuleType(self)Tell AutoLoader what type of modules to autoload. DatabaseAssistant mixes in aquarium.util.AutoLoader. Here, we must override getModuleType to tell AutoLoader which directory to import the "table classes" from. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 | http://epydoc.sf.net |