The Virtual Brain Project

Table Of Contents

Previous topic

services Package

Next topic

datatype_removers Package

This Page

traits Package


class tvb.core.traits.core.DeclarativeMetaType(classname, bases, dict_)[source]

Bases: sqlalchemy.ext.declarative.DeclarativeMeta, tvb.basic.traits.core.MetaType

The DeclarativeMetaType class helps with class creation by automating some of the sqlalchemy code generation. We code for three possibilities:

  • the sql or db keywords are False, no sqlalch used

  • sql or db keywords are True or unset, default sqlalche used

  • sql or db keywords are set with sqlalchemy.Column instances, and

    that is used

If it is desired that no sql/db is used, import traits.core and set TRAITS_CONFIGURATION.use_storage = False. This will have the (hopefully desired) effect that all sql and db keyword args are ignored.


Given a class name compute the name of the corresponding SQL table.

tvb.core.traits.core.log_warnings(message, category, filename, lineno, file=None, line=None)[source]


Python Triggers on DB operations.


Attach events to all mapped tables.

tvb.core.traits.db_events.fill_before_insert(_, _ignored, target)[source]

Trigger before storing MappedEntities in DB. Any time, when attaching an entity to the session, make sure meta-data are cascaded on update-able attributes automatically.

tvb.core.traits.db_events.initialize_on_load(target, _)[source]

Call this when any entity is loaded from DB. In case the entity inherits from MappedType, load associated relationships. e.g. TimeSeriesRegion.regions(of type Connectivity) should be populated with:

  • Connectivity instance, and not be a GID, as is default after DB storage.


A mapping from traited datatypes to sql types.


Look for a SQL-alchemy mapping for the parameter input_class. Also go through all its base classes and check if any of them have a mapping.



traited class Array traits on this class:

dtype ()

default: None

Mix-in class combining core Traited mechanics with the db’ed DataType class enabling SQLAlchemy.

traits on this class:


traited class SparseMatrix traits on this class:

dtype ()

default: None