radloggerpy.database.objects.device module

class radloggerpy.database.objects.device.DeviceObject(**kwargs)[source]

Bases: DatabaseObject

device object with base model attributes

_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

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

enabled = 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.

static find_enabled(session)[source]
id = None
implementation = None
interface = None
m_device = None
name = None
type = 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