Interface Classes#
Tools for ingesting data into a datajoint database.
Model a datajoint schema, tagging properties of the model as needed
- class wehrdj.interface.interface.SchemaInterface[source]#
Metaclass for making interfaces from existing data structures to datajoint schema.
To use:
Assign the relevant schema as a
schema
class attributeWrite code to either assign values from your particular data structure as attributes or properties with the same names as the fields in the database
Connect and hopefully it will be able to insert your row!
For an example, see
Session
- property field_names: List[str]#
List of fields that must be defined for this schema
- Returns
list[str] = list of field names
- property field_values: Dict[str, Any]#
Values that have been given, either as attrs or properties, for all the items in the schema
- Returns
dict[str, Any]
- insert(**kwargs)[source]#
Insert this schema entry into the table. You must have already called
wehrcj.connect()
or else datajoint will prompt you.- Parameters
**kwargs – passed on to
insert()
- Raises
- abstract property schema: UserTable#
The schema that this class models.
(Should be overridden as a class attribute rather than a property, this is just how the abc interface works)
- property table: datajoint_babel.model.table.Table#
The abstract representation of the datajoint model in the
definition
eg. for session:
Table( name='Session', tier='Manual', comment=None, keys=[ Dependency(dependency='Subject'), Attribute( name='session_datetime', datatype=DJ_Type(datatype='datetime', args=3, unsigned=False), comment='', default=None ) ], attributes=[] )
- Returns
Table