radloggerpy.database.objects.measurement module

class radloggerpy.database.objects.measurement.MeasurementObject(**kwargs)[source]

Bases: DatabaseObject

Measurement object with base model attributes

The device attribute can be set to an instance of radloggerpy.database.objects.device.DeviceObject with any desired attribute set. When this is set it will be used by methods if applicable.

_abc_impl = <_abc._abc_data object>
_build_attributes()[source]

Build the attributes for the given state of internal models

_build_object()[source]

Build the object with its given attributes for internal models

static add(session, reference)[source]

Add the reference object to the database

Parameters:
  • session – an active sqlalchemy.orm.session.Session

  • reference – add database entries based on this object

static add_all(session, references)[source]

Add all specified objects to the database

Parameters:
  • session – an active sqlalchemy.orm.session.Session

  • references – add all these objects to the database

cpm = None
static delete(session, reference, allow_multiple=False)[source]

Remove the object(s) that match the reference

Parameters:
  • session – an active sqlalchemy.orm.session.Session

  • reference – remove database entries based on this object

  • allow_multiple – if updating multiple database items is allowed

Raises:

MultipleResultsFound – if multiple results were found with allow_multiple as False of type sqlalchemy.exc.MultipleResultsFound

device = None
static find(session, reference, allow_multiple=True)[source]

Return object(s) that match the reference

Parameters:
  • session – an active sqlalchemy.orm.session.Session

  • reference – find database results based on this object

  • allow_multiple – if updating multiple database items is allowed

Raises:

MultipleResultsFound – if multiple results were found with allow_multiple as False of type sqlalchemy.exc.MultipleResultsFound

Returns:

A single object, list of objects or none, all objects will be instances of the class.

static find_all(session, references)[source]

For every specified object find all its matching database objects

Parameters:
  • session – an active sqlalchemy.orm.session.Session

  • references – find database results based on these objects

Returns:

list of objects or none, all objects will be instances of the class.

id = None
m_measurement = None
svh = None
timestamp = None
static update(session, reference, base, allow_multiple=False)[source]

Find the reference(s) in the database and update with own state

Parameters:
  • session – an active sqlalchemy.orm.session.Session

  • reference – the object with the desired changes

  • base – current state of the object in the database

  • allow_multiple – if updating multiple database items is allowed

Raises:

MultipleResultsFound – if multiple results were found with allow_multiple as False of type sqlalchemy.exc.MultipleResultsFound