mdbmanager Module

mdbmanager.py This module contains Mewlo database manager class.

class mewlo.mpacks.core.database.mdbmanager.MewloDatabaseManager(mewlosite, debugmode)[source]

Bases: mewlo.mpacks.core.manager.manager.MewloManager

The MewloDatabaseManager supervises database support.

commit_all_dbs()[source]

Nothing to do in base class.

commit_on_request_ends()[source]

Nothing to do in base class.

create_derived_dbmodelclass(owner, baseclass, classname=None, tablename=None, schemaname='default')[source]

Create a new CLASS based on another model class, with a custom classname and tablename. We only need to use this when we want to dynamically create multiple tables based from the same base model class. NOTE: This function does not register the class with Mewlo and define its database fields.

create_mapper_forallmodelclasses()[source]

Create relationships for all registered model classes (that haven’t already been created).

create_mapper_formodelclass(modelclass)[source]

Create the relationships for this model.

create_prerequisites_forallmodelclasses()[source]

Create fields for all registered model classes (that haven’t already been created).

create_prerequisites_formodelclass(modelclass)[source]

Create the fields for this model.

create_table_forallmodelclasses()[source]

Create fields for all registered model classes (that haven’t already been created).

create_table_formodelclass(modelclass)[source]

Create the fields for this model.

create_tableandmapper_forallmodelclasses()[source]

We are ready to create all fields, THEN all relationships, for known model classes.

create_tableandmapper_foroneclass(modelclass)[source]

We are ready to create all fields, THEN all relationships, for a specific model classes.

description = 'Databae manager provides the API interface for database operations'
dumps(indent=0)[source]

Debug information.

get_schemasettings_val(schemaname, keyname, defaultval)[source]

Lookup a setting value for a schema, falling back to default schema; if still not found return default.

get_tablenameprefix(schemaname)[source]

Return the prefix that should be used on a table in the specified schema. In common use this will be an empty string.

lookupclass(modelclassname)[source]

Lookup a registered model class by name.

makedbtable_one(tablename)[source]

Implemented by subclass to create all database tables from registered models.

makedbtables_all()[source]

Implemented by subclass to create all database tables from registered models.

process_request_ends(request)[source]

Do stuff before processing a request.

register_modelclass(owner, modelclass)[source]

Register a datbase model class. Note that in doing this, we do not yet create columns and fields for it, we are simply telling the database manager it exists. It is essential that EVERY model class used in any fashion register itself in this way, so that the tables get created and the manager get set for the modelclass Which also lets model classes know about any tablename prefixes, etc.

reset_classdata_forallmodelclasse(modelclass)[source]

Reset cached sqla database data.

reset_classdata_forallmodelclasses()[source]

Reset all chached data for sqla database stuff for model classes.

resolve(text)[source]

Sometimes database engine configuration settings will use mewlo aliases like {$databasedirectory}, etc. This resolves them.

set_databasesettings(databasesettings)[source]

Simple accessor.

set_isreadytodb_forallmodelclasses()[source]

Set ready flag for all model classes.

set_isreadytodb_formodelclass(modelclass)[source]

Set ready flag for this model.

shutdown()[source]

Shutdown the database. Before we do, we flush it to save any pending saves.

startup_prep(stageid, eventlist)[source]

This is invoked by site strtup, for each stage specified in startup_stages_needed() above.

typestr = 'core'

Table Of Contents

This Page