SLiMSuite REST Server

EdwardsLab Homepage
EdwardsLab Blog
SLiMSuite Blog
REST Pages
REST Status
REST Tools
REST Alias Data
REST Sitemap

rje_db V1.9.0

R Edwards Relational Database module

Module: rje_db
Description: R Edwards Relational Database module
Version: 1.9.0
Last Edit: 19/01/18

Copyright © 2007 Richard J. Edwards - See source code for GNU License Notice

Imported modules: rje rje_scoring rje_zen

See SLiMSuite Blog for further documentation. See rje for general commands.


This module is designed to read in and store data as a series of tables in a similar fashion to a database, e.g. MySQL. Although undoubtedly slower than such dedicated software for querying etc., this module is primarily designed for used to make links and manipulate data and tables on the fly in other python modules.

The main Database Class will control the linking etc. of tables, which are in turn stored in the Table Class.

NB. This module should not be confused with rje_dbase, which is for downloading and processing public databases.


dbindex=T/F : Whether to run in "index" mode, storing a file position rather than all data (read only) !Not yet implemented! [False]
Additional Commandline functionality will be added with time.

History Module Version History

    # 0.0 - Initial Compilation.
    # 0.1 - Added merge tables option.
    # 0.2 - Miscellaneous updates to various methods.
    # 0.3 - Minor doc tweaks and added keepFields().
    # 0.4 - Improved use of AutoID and added Table.autoID() method.
    # 0.5 - Initial coding of index mode. (Not yet fully functional.)
    # 1.0 - Working, so upgraded to version 1.0!
    # 1.1 - Added sortedEntries() function.
    # 1.2 - Added Table.hasField(field). Add openTable(), readEntry() and readSet() methods.
    # 1.3 - Minor modifications for SLiMCore FUPC development.
    # 1.4 - Added list checking with addEmptyTable.
    # 1.5 - Fixed occasional key error following addField. Added indexReport() method.
    # 1.6 - Added option to save a subset of entries using saveToFile(savekeys=LIST).
    # 1.7.0 - Added splitchar to table splitting.
    # 1.7.1 - Reinstated raise error if expected table missing.
    # 1.7.2 - Fixed numerical join issue during Table.compress().
    # 1.7.3 - Added lower case enforcement of headers for reading tables from file.
    # 1.7.4 - Added optional restricted Field set for output.
    # 1.7.5 - Added more error messages and tableNames() method.
    # 1.7.6 - Added table.opt['Formatted'] = Whether table data has been successfully formatted using self.dataFormat()
    # 1.7.7 - Added option to constrain table splitting to certain field values.
    # 1.8.0 - Added option to store keys as tuples for correct sorting. (Make default at some point.)
    # 1.8.1 - Added sfdict to saveTable output.
    # 1.8.2 - Fixed minor readSet bug.
    # 1.8.3 - Minor debugging message changes.
    # 1.8.4 - Cosmetic log message changes.
    # 1.8.5 - Added saveToFileName() function.
    # 1.8.6 - Minor IndexReport tweak.
    # 1.9.0 - Added comment output to saveToFile().

© 2015 RJ Edwards. Contact: