API Reference#
PIconnect - Connector to the OSISoft PI and PI-AF databases.
- class PIconnect.AFDatabase(server: str | None = None, database: str | None = None)#
Bases:
objectContext manager for connections to the PI Asset Framework database.
- event_frames(start_time: str | datetime = '', start_index: int = 0, max_count: int = 1000, search_mode: EventFrameSearchMode = EventFrameSearchMode.FORWARD_FROM_START_TIME, search_full_hierarchy: bool = False) dict[str, AFEventFrame]#
Search for event frames in the database.
- property children: dict[str, AFElement]#
Return a dictionary of the direct child elements of the database.
- database#
The PI AF database connection.
- search: Search#
Search reference for searching objects in the database. See
Search.Searchfor more information.
- server#
The PI AF server connection.
- version = '0.3.0'#
- class PIconnect.PIAFDatabase(server: str | None = None, database: str | None = None)#
Bases:
AFDatabaseContext manager for connections to the PI Asset Framework database.
Deprecated since version 1.0.0: Use
AFDatabaseinstead.- event_frames(start_time: str | datetime = '', start_index: int = 0, max_count: int = 1000, search_mode: EventFrameSearchMode = EventFrameSearchMode.FORWARD_FROM_START_TIME, search_full_hierarchy: bool = False) dict[str, AFEventFrame]#
Search for event frames in the database.
- property children: dict[str, AFElement]#
Return a dictionary of the direct child elements of the database.
- database#
The PI AF database connection.
- search: Search#
Search reference for searching objects in the database. See
Search.Searchfor more information.
- server#
The PI AF server connection.
- version = '0.3.0'#
- class PIconnect.PIServer(server: str | None = None, username: str | None = None, password: str | None = None, domain: str | None = None, authentication_mode: AuthenticationMode = AuthenticationMode.PI_USER_AUTHENTICATION, timeout: int | None = None)#
Bases:
objectPIServer is a connection to an OSIsoft PI Server.
- Parameters:
server (str, optional) – Name of the server to connect to, defaults to None
username (str, optional) – Username to connect to the server, defaults to None
password (str, optional) – Password for the username, defaults to None
domain (str, optional) – Domain of the username, defaults to None
authentication_mode (AuthenticationMode, optional) – Authentication mode to use, defaults to PI_USER_AUTHENTICATION
timeout (int, optional) – the maximum seconds an operation can take
Note
If the specified server is unknown a warning is thrown and the connection is redirected to the default server, as if no server was passed. The list of known servers is available in the PIServer.servers dictionary.
- search(query: str | list[str], source: str | None = None) DataContainerCollection[PIPoint]#
Search PIPoints on the PIServer.
- Parameters:
- Returns:
A collection of
PIPointobjects as a result of the query.- Return type:
Todo
Reject searches while not connected
- property server_name#
Name of the connected server.
- PIconnect.load_SDK(assembly_path: str | Path | None = None) None#
Load the AF SDK from the specified path.
- Parameters:
assembly_path (str | pathlib.Path, optional) – Path to the directory containing the AF SDK assembly. If None, the default installation path will be used.
- Raises:
ImportError – If the AF SDK cannot be found or loaded.
Generic utility modules#
- PIconnect.Data module
- Data containers
DataContainerDataContainer.filtered_summaries()DataContainer.interpolated_value()DataContainer.interpolated_values()DataContainer.recorded_value()DataContainer.recorded_values()DataContainer.summaries()DataContainer.summary()DataContainer.update_value()DataContainer.current_valueDataContainer.nameDataContainer.stepped_dataDataContainer.units_of_measurement
DataContainerCollectionDataContainerCollection.filtered_summaries()DataContainerCollection.interpolated_value()DataContainerCollection.interpolated_values()DataContainerCollection.recorded_value()DataContainerCollection.recorded_values()DataContainerCollection.summaries()DataContainerCollection.summary()DataContainerCollection.current_value
- AF Enumeration Values
- Enumerations
- Data containers
- PIconnect.PIConsts module
- PIconnect.Search module
- PIconnect.Time module
- PIconnect._collections module
- PIconnect.config module
- PIconnect.dotnet module