Skip to content

DataLoggerEngine API

class automation.logger.datalogger.DataLoggerEngine(*args, **kwargs)

Thread-safe Engine for the DataLogger.

This class provides a thread-safe wrapper around the DataLogger class, ensuring that database operations from multiple threads do not conflict.

set_tag(self, tag)

Registers a tag for logging in the database, using a thread-safe call.

Parameters:

  • tag (Tag): The tag object to register.
get_tags(self)

Retrieves all tags from the database (thread-safe).

update_tag(self, id, user=None, **kwargs)

Updates tag configuration (thread-safe).

Parameters:

  • id (str): Tag ID.
  • kwargs: Properties to update.
delete_tag(self, id)

Deletes a tag (thread-safe).

Parameters:

  • id (str): Tag ID.
create_tables(self, tables)

Creates default database tables.

Parameters:

  • tables (list): List of database models.
drop_tables(self, tables)

Drops specified tables from the database.

Parameters:

  • tables (list): List of database models.
get_tag_by_name(self, name)

Retrieves a tag by name (thread-safe).

write_tag(self, tag, value, timestamp)

Writes a single tag value (thread-safe).

Parameters:

  • tag (str): Tag name.
  • value (float): Value.
  • timestamp (datetime): Timestamp.
write_tags(self, tags)

Batch writes tag values (thread-safe).

Parameters:

  • tags (list): List of tag value dictionaries.
read_trends(self, start, stop, timezone, *tags)

Reads trend data (thread-safe).

Parameters:

  • start (str): Start time.
  • stop (str): End time.
  • timezone (str): Timezone.
  • tags: Variable length argument of tag names.
read_tabular_data(self, start, stop, timezone, tags, sample_time, page=1, limit=20)

Reads tabular data (thread-safe).

read_segments(self)

Reads segments (thread-safe).