InfluxDBProfileManager

class profiles.influxdbprofilemanager.ConnectionSettings(host: str, port: int, username: str, password: str, database: str, ssl: bool, verify_ssl: bool)

The ConnectionSettings class represents all required settings that are required to connect to an InfluxDB server

host: str

hostname of the InfluxDB server to connect to

port: int

port to connect to

username: str

username of the user that has permission to access the database

password: str

password of the user

database: str

database to connect to

ssl: bool

indicates whether or not to use SSL when connecting to the InfluxDB server

verify_ssl: bool

indicates wether or not to verify SSL certificates

class profiles.influxdbprofilemanager.InfluxDBProfileManager(settings: ConnectionSettings, source_profile=None)

InfluxDBProfileManager: manages profile data that can be loaded from and saved to InfluxDB (v1 only). InfluxDBProfileManager is a subclass of ProfileManager, so it also provides functionality to convert from/to different ESDL profiles and to load/save to CSV

load_influxdb(measurement: str, fields: list, from_datetime: datetime | None = None, to_datetime: datetime | None = None, filters: list | None = None)

Loads profile information from InfluxDB

Parameters:
  • measurement – the name of the measurement to use in InfluxDB

  • fields – a list of field names that need to be loaded from InfluxDB

  • from_datetime – the start datetime (included in the data)

  • to_datetime – the end datetime (included in the data)

  • filters – a list of dictionaries with ‘tag’ and ‘value’ keys, that can be used to filter on the data

Returns:

None

static create_esdl_influxdb_profile_manager(esdl_profile: InfluxDBProfile, username: str | None = None, password: str | None = None, use_ssl: bool = False, verify_ssl: bool = False)

method to create an instance of InfluxDBProfileManager using an esdl.InfluxDBProfile. The data referenced to in the profile is loaded from InfluxDB

Parameters:
  • esdl_profile – esdl.InfluxDBProfile that is used as an input profile

  • username – username to be used to connect to the InfluxDB server mentioned in the esdl.InfluxDBProfile, defaults to None

  • password – password to be used to connect to the InfluxDB server mentioned in the esdl.InfluxDBProfile, defaults to None

  • use_ssl – indicates if HTTPS should be used instead of HTTP to connect to the InfluxDB server, defaults to False

  • verify_ssl – verify SSL certificates for HTTPS requests, defaults to False

get_esdl_influxdb_profile(measurement: str, field_names: list, tags: dict | None = None)

Creates an esdl.InfluxDBProfile instance (or a list of instances) that refers to the data in the database. Is called by load_influxdb and save_influxdb

Parameters:
  • measurement – name of the InfluxDB measurement where the data must be written to

  • field_names – list of the fields that should be written to InfluxDB

  • tags – dictionary with tags and tag values, that should be used when writing this data to InfluxDB

Returns:

an esdl.InfluxDBProfile instance or a list of esdl.InfluxDBProfile instances in case multiple fields were specified, with proper references to the data in the database

save_influxdb(measurement: str, field_names: list, tags: dict | None = None)

Saves profile information to InfluxDB

Parameters:
  • measurement – name of the InfluxDB measurement where the data must be written to

  • field_names – list of the fields that should be written to InfluxDB

  • tags – dictionary with tags and tag values, that should be used when writing this data to InfluxDB

Returns:

an esdl.InfluxDBProfile instance or a list of esdl.InfluxDBProfile instances in case multiple fields were specified, with proper references to the data in the database

exception profiles.influxdbprofilemanager.NoDataException

Thrown when no profile data can be written to InfluxDB

exception profiles.influxdbprofilemanager.WrongFilterFormatException

Thrown when filter specification in ESDL profile cannot be parsed

exception profiles.influxdbprofilemanager.WrongTagsFormatException

Thrown when the tags parameter has the wrong structure