Package aquarium :: Package database :: Module QuickSwitchDatabaseAssistant :: Class QuickSwitchDatabaseAssistant
[show private | hide private]
[frames | no frames]

Class QuickSwitchDatabaseAssistant

AquariumClass --+    
   AutoLoader --+    
DatabaseAssistant --+

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 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
  __init__(self, ctx)
Initialize private variables.
Rollback anything uncommitted.
Close the connection do the database.
Commit the current transaction.
Connect to the database.
Get a cursor object.
  fetchalldicts(self, cursor)
Fetch all rows and return a list of dicts.
  fetchalldictsgenerator(self, cursor)
This is a generator for fetching all rows as dicts.
  fetchonedict(self, cursor, force)
Fetch one row as a dict.
Rollback the current transaction.
    Inherited from AutoLoader
  __getattr__(self, attr)
Import, instantiate, and return the desired instance.

Method Details


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.


Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007