lce_service.dynamic_app_api.retrieve_entities module

lce_service.dynamic_app_api.retrieve_entities.get_alerts_for_dynamic_application(dbc: silo_cursor, app_id: int) → List[AlertObject] | None

Retrieve and validate all Alert objects associated with a Dynamic Application.

Parameters:
  • dbc – A silo_cursor instance used to execute the database query.

  • app_id – The ID of the Dynamic Application whose Alert Objects should be retrieved.

Returns:

A list of validated AlertObject model instances.

Raises:
  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when the database query fails.

lce_service.dynamic_app_api.retrieve_entities.get_code_for_dynamic_application(dbc: silo_cursor, app_id: int, pretty: bool, include: str | None = None, exclude: str | None = None) → Dict[str, Any]

Retrieve and serialize a complete Dynamic Application configuration as a dictionary.

This function acts as a wrapper around get_dynamic_application_model, fetching a complete Dynamic Application with all its associated components and converting it to a dictionary representation suitable for serialization or API responses. The include and exclude parameters allow for selective field inclusion/exclusion in the returned dictionary representation.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries and fetch Dynamic Application data from the master database.

  • app_id – The unique integer identifier (aid) of the Dynamic Application to retrieve from the database.

  • pretty – A boolean flag controlling the output format of the returned dictionary. When True, the model dump includes additional formatting for readability. When False, returns a compact dictionary representation.

  • include – An optional string specifying which fields to include in the output. When provided, only the specified fields will be included in the returned dictionary. If None, all fields are included by default.

  • exclude – An optional string specifying which fields to exclude from the output. When provided, the specified fields will be omitted from the returned dictionary. If None, no fields are excluded by default.

Returns:

A dictionary containing the complete Dynamic Application configuration, including all nested components (collection_objects, snippets, presentations, and thresholds), formatted according to the pretty parameter and filtered according to the include/exclude parameters.

Raises:
  • MissingResourceError – When no Dynamic Application exists with the specified app_id.

  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when any database query execution fails for any reason.

lce_service.dynamic_app_api.retrieve_entities.get_code_for_event_policy(dbc: silo_cursor, event_id: int, pretty: bool, include: str | None = None, exclude: str | None = None) → Dict[str, Any]

Retrieve and serialize a complete Event Policy configuration as a dictionary.

This function acts as a wrapper around get_event_policy_model, fetching a complete Event Policy with all its associated components and converting it to a dictionary representation suitable for serialization or API responses. The include and exclude parameters allow for selective field inclusion/exclusion in the returned dictionary representation.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries and fetch Event Policy data from the master database.

  • event_id – The unique integer identifier (id) of the Event Policy to retrieve from the database.

  • pretty – A boolean flag controlling the output format of the returned dictionary. When True, the model dump includes additional formatting for readability. When False, returns a compact dictionary representation.

  • include – An optional string specifying which fields to include in the output. When provided, only the specified fields will be included in the returned dictionary. If None, all fields are included by default.

  • exclude – An optional string specifying which fields to exclude from the output. When provided, the specified fields will be omitted from the returned dictionary. If None, no fields are excluded by default.

Returns:

A dictionary containing the Event Policy configuration with all associated components (auto_clear_events) and detailed information. The dictionary content is filtered according to the include/exclude parameters and formatted according to the pretty parameter.

Raises:
  • MissingResourceError – When no Event Policy exists with the specified event_id.

  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when any database query execution fails for any reason.

lce_service.dynamic_app_api.retrieve_entities.get_code_for_powerpack(dbc: silo_cursor, powerpack_id: int, pretty: bool, include: str | None = None, exclude: str | None = None) → Dict[str, Any]

Retrieve and serialize a complete PowerPack configuration as a dictionary.

This function acts as a wrapper around get_powerpack_model, fetching a complete PowerPack with all its associated components and converting it to a dictionary representation suitable for serialization or API responses. The include and exclude parameters allow for selective field inclusion/exclusion in the returned dictionary representation.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries and fetch PowerPack data from the master database.

  • powerpack_id – The unique integer identifier (ppid) of the PowerPack to retrieve from the database.

  • pretty – A boolean flag controlling the output format of the returned dictionary. When True, the model dump includes additional formatting for readability. When False, returns a compact dictionary representation.

  • include – An optional string specifying which fields to include in the output. When provided, only the specified fields will be included in the returned dictionary. If None, all fields are included by default.

  • exclude – An optional string specifying which fields to exclude from the output. When provided, the specified fields will be omitted from the returned dictionary. If None, no fields are excluded by default.

Returns:

A dictionary containing the PowerPack configuration with all nested components (dynamic_applications) and detailed information. The dictionary content is filtered according to the include/exclude parameters and formatted according to the pretty parameter.

Raises:
  • MissingResourceError – When no PowerPack exists with the specified powerpack_id.

  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when any database query execution fails for any reason.

lce_service.dynamic_app_api.retrieve_entities.get_collection_objects_for_dynamic_application(dbc: silo_cursor, app_id: int) → List[CollectionObject] | None

Retrieve and validate all Collection objects associated with a Dynamic Application.

Parameters:
  • dbc – A silo_cursor instance used to execute the database queries.

  • app_id – The ID of the Dynamic Application whose Collection Objects should be retrieved.

Returns:

A list of validated CollectionObject model instances, including their component identifiers and discovery fields.

Raises:
  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when a database query fails.

lce_service.dynamic_app_api.retrieve_entities.get_complete_dynamic_app(dbc: silo_cursor, dynamic_app: DynamicApp) → DynamicApp

Build the complete resulting state of a Dynamic Application for strict validation.

The child entities provided in the request replace their stored version, and the stored child entities that are not provided are added, so strict validation covers the whole resulting Dynamic Application. Stored entities that are not provided have no provided fields. The request’s DynamicApp model is not modified; only the entities it provides are written.

Parameters:
  • dbc – A silo_cursor instance used to retrieve the stored child entities.

  • dynamic_app – The DynamicApp model built from the request payload.

Returns:

The DynamicApp model to validate. For a new Dynamic Application, the request’s model is returned as it has no stored child entities.

Raises:
  • InvalidResourceError – Raised when a stored child entity that is not provided has stored values that fail validation (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when a database query fails.

lce_service.dynamic_app_api.retrieve_entities.get_dynamic_application_object(dbc: silo_cursor, app_id: int) → DynamicApp

Retrieve a Dynamic Application, without its child entities, from the database.

Parameters:
  • dbc – A silo_cursor instance used to execute the database queries.

  • app_id – The ID of the Dynamic Application to retrieve.

Returns:

A validated DynamicApp model instance with the Dynamic Application fields and the Dynamic Applications aligned through component mapping.

Raises:
  • MissingResourceError – When no Dynamic Application exists with the specified app_id.

  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when a database query fails.

lce_service.dynamic_app_api.retrieve_entities.get_dynamic_applications_from_filters(dbc: silo_cursor, args: Dict[str, str], pretty: bool, include: str | None, exclude: str | None, require_all: bool) → Dict[str, List[Dict[str, Any]] | List[str]]

Retrieve and serialize Dynamic Applications matching specified filter criteria.

Queries the database to find Dynamic Applications that match the provided filter criteria, then retrieves and validates the complete Dynamic Application configurations for each matching application. The function constructs SQL WHERE clauses from the filter arguments and allows for both ‘AND’ and ‘OR’ logic when multiple filters are specified.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries and fetch Dynamic Application data from the master database.

  • args – A dictionary of query parameters, typically from request.args, where keys are parameter names and values are parameter values.

  • pretty – A boolean flag controlling the output format of the returned dictionaries. When True, the model dump includes additional formatting for readability. When False, returns compact dictionary representations.

  • include – An optional string specifying which fields to include in the output dictionaries. When provided, only the specified fields will be included in the returned Dynamic Application dictionaries. If None, all fields are included by default.

  • exclude – An optional string specifying which fields to exclude from the output dictionaries. When provided, the specified fields will be omitted from the returned Dynamic Application dictionaries. If None, no fields are excluded by default.

  • require_all – A boolean flag controlling how multiple filter criteria are combined. When True, all filter criteria must match (AND logic). When False, any filter criteria can match (OR logic).

Returns:

A dictionary containing two keys: - “dynamic_applications”: A list of dictionaries representing the Dynamic

Applications that matched the filter criteria, with each dictionary containing the complete application configuration formatted according to the pretty parameter and filtered according to include/exclude parameters.

  • ”errors”: A list of error message strings for any Dynamic Applications that were found but failed to be retrieved or validated during processing.

Raises:
  • DatabaseExecutionError – Raised when any database query execution fails for any reason during the filtering or retrieval process.

  • MissingResourceError – Raised when no Dynamic Applications were found matching the provided filter criteria

  • ValueError – If any filter parameters are malformed, reference invalid field names, or use unsupported operators. Also, if either no valid filters were provided.

lce_service.dynamic_app_api.retrieve_entities.get_dynamic_apps_from_payload(dbc: silo_cursor, payload: List[Dict[str, Any]] | Dict[str, Any]) → List[DynamicApp]

Convert payload data into a list of validated DynamicApp model instances.

Takes either a single dictionary or a list of dictionaries representing Dynamic Application data and converts them into validated DynamicApp Pydantic model instances. Existing entities (the Dynamic Applications and their child entities identified by GUID) are built from their complete state: the stored values updated with the values provided in the payload. The fields provided in the payload are recorded on each model (see provided_fields). This function serves as a normalization layer that accepts flexible input formats and ensures consistent output as a list of validated models.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries for validating Dynamic Application GUIDs against existing records in the master database.

  • payload – The input data to convert, which can be either: - A single dictionary containing Dynamic Application data - A list of dictionaries, each containing Dynamic Application data When a single dictionary is provided, it is automatically wrapped in a list.

Returns:

A list of validated DynamicApp model instances. Returns an empty list if an empty list is provided as input. Each instance in the list has been validated against the DynamicApp model schema.

Raises:
  • InvalidResourceError – Raised when any dictionary in the payload fails validation against the DynamicApp model schema, containing formatted error messages describing all validation failures, or when a Dynamic Application GUID is provided more than once.

  • MissingResourceError – Raised when any specified Dynamic Application GUID does not exist in the database.

  • DatabaseExecutionError – Raised when the database query execution fails during GUID validation for any reason.

  • ValueError –

    Raised when the payload format is invalid, including:
    • Payload is neither a dictionary nor a list

    • The ‘dynamic_applications’ property exists but is not a list

    • Any item in the Dynamic Applications list is not a dictionary

    Contains formatted error messages describing the specific validation failure encountered.

lce_service.dynamic_app_api.retrieve_entities.get_event_ids_from_guids(dbc: silo_cursor, event_guids: Set[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)]]) → Dict[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)], int]

Retrieve database IDs for Event Policies that can be cleared by other events.

This function queries the database to find Event Policy records that correspond to the provided GUIDs and returns a mapping of their GUIDs to their database IDs. It validates that the specified Event Policy GUIDs exist in the database and creates a lookup mapping for use in event clearing relationship operations. If no GUIDs are provided, an empty mapping is returned without any database queries.

Performs a database query to retrieve Event Policy data from the EVENT_POLICY_TABLE, filters by the provided GUIDs, and creates a dictionary mapping each GUID to its corresponding database ID for efficient lookup during event clearing operations.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries for retrieving Event Policy data from the master.dynamic_app_event_policies table. This cursor should be properly configured and connected to the database before calling this function.

  • event_guids – A set of Event Policy GUIDs representing the events that can potentially be cleared by other Event Policies. These GUIDs are used to query the database and retrieve the corresponding Event Policy records. An empty set will result in an empty mapping being returned without any database queries.

Returns:

A dictionary mapping Event Policy GUIDs to their corresponding database IDs (integers). Each key represents an Event Policy GUID from the input set that exists in the database, and the corresponding value is the database ID for that Event Policy. Event Policy GUIDs that don’t exist in the database will not be included in the returned mapping.

Raises:

DatabaseExecutionError – Raised when the database query execution fails during the retrieval of Event Policy data, as propagated from the underlying get_fields_from_table function.

lce_service.dynamic_app_api.retrieve_entities.get_event_policies_from_filters(dbc: silo_cursor, args: Dict[str, str], pretty: bool, include: str | None, exclude: str | None, require_all: bool) → Dict[str, List[Dict[str, Any]] | List[str]]

Retrieve and serialize Event Policies matching specified filter criteria.

Queries the database to find Event Policies that match the provided filter criteria, then retrieves and validates the complete Event Policy configurations for each matching policy. The function constructs SQL WHERE clauses from the filter arguments and allows for both ‘AND’ and ‘OR’ logic when multiple filters are specified.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries and fetch Event Policy data from the master database.

  • args – A dictionary of query parameters, typically from request.args, where keys are parameter names and values are parameter values. Used to construct filter criteria for the database query.

  • pretty – A boolean flag controlling the output format of the returned dictionaries. When True, the model dump includes additional formatting for readability. When False, returns compact dictionary representations.

  • include – An optional string specifying which fields to include in the output dictionaries. When provided, only the specified fields will be included in the returned Event Policy dictionaries. If None, all fields are included by default.

  • exclude – An optional string specifying which fields to exclude from the output dictionaries. When provided, the specified fields will be omitted from the returned Event Policy dictionaries. If None, no fields are excluded by default.

  • require_all – A boolean flag controlling how multiple filter criteria are combined. When True, all filter criteria must match (AND logic). When False, any filter criteria can match (OR logic).

Returns:

A dictionary containing two keys: - “event_policies”: A list of dictionaries representing the Event

Policies that matched the filter criteria, with each dictionary containing the complete policy configuration formatted according to the pretty parameter and filtered according to include/exclude parameters.

  • ”errors”: A list of error message strings for any Event Policies that were found but failed to be retrieved or validated during processing.

Raises:
  • DatabaseExecutionError – Raised when any database query execution fails for any reason during the filtering or retrieval process.

  • MissingResourceError – Raised when no Event Policies were found matching the provided filter criteria.

  • ValueError – If any filter parameters are malformed, reference invalid field names, or use unsupported operators. Also raised if no valid filters were provided.

lce_service.dynamic_app_api.retrieve_entities.get_event_policies_from_payload(dbc: silo_cursor, payload: List[Dict[str, Any]] | Dict[str, Any]) → List[EventPolicy]

Convert payload data into a list of validated EventPolicy model instances.

Takes either a single dictionary or a list of dictionaries representing Event Policy data and converts them into validated EventPolicy Pydantic model instances. This function serves as a normalization layer that accepts flexible input formats and ensures consistent output as a list of validated models.

Parameters:
  • dbc – A silo_cursor instance used to retrieve the stored values of the existing Event Policies, which are merged with the provided values (see merge_entity_data).

  • payload –

    The input data to convert, which can be either: - A single dictionary containing Event Policy data - A list of dictionaries, each containing Event Policy data - A dictionary with an ‘event_policies’ key containing a list of

    Event Policy dictionaries

    When a single dictionary is provided without the ‘event_policies’ key, it is treated as a single Event Policy.

Returns:

A list of validated EventPolicy model instances. Each instance in the list has been validated against the EventPolicy model schema and contains the complete Event Policy configuration data from the payload.

Raises:
  • InvalidResourceError – Raised when any dictionary in the payload fails validation against the EventPolicy model schema, containing formatted error messages describing all validation failures. Also raised when the same GUID is provided more than once.

  • ValueError –

    Raised when the payload format is invalid, including:
    • Payload is neither a dictionary nor a list

    • The ‘event_policies’ property exists but is not a list

    • Any item in the Event Policies list is not a dictionary

    • No Event Policies are provided in the payload

    Contains formatted error messages describing the specific validation failure encountered.

lce_service.dynamic_app_api.retrieve_entities.get_execution_environment(dbc: silo_cursor, collection_env: str | None) → ExecutionEnvironment | None

Retrieve the execution environment for a given environment GUID.

Queries the database to fetch the execution environment record associated with the specified execution environment GUID from the master.exec_envs table. The retrieved data is validated and converted into an ExecutionEnvironment model instance.

Parameters:
  • dbc – A silo_cursor instance used to execute the database query and fetch execution environment data from the master database.

  • collection_env – The unique GUID identifier of the execution environment to look up. If None or empty, the function returns None immediately without performing any database operations.

Returns:

A validated ExecutionEnvironment model instance if found and validation succeeds, or None if no matching execution environment exists for the given GUID, if the collection_env parameter is None/empty, or if validation fails.

Raises:

DatabaseExecutionError – Raised when the database query execution fails for any reason.

lce_service.dynamic_app_api.retrieve_entities.get_existing_cleared_event_ids(dbc: silo_cursor, event_ids: Set[int]) → Dict[int, List[int]]

Retrieve existing cleared event IDs for the specified clearer event IDs.

This function queries the database to find all event IDs that are currently configured to be cleared by the provided clearer event IDs. It returns a mapping of clearer event IDs to their corresponding lists of cleared event IDs. For clearer event IDs that have no existing cleared events, an empty list is returned in the mapping.

Performs a database query to retrieve the existing event clearing relationships from the EVENT_CLEARING_TABLE, groups the results by clearer_id, and processes the comma-separated cleared_ids into individual integer lists for easier programmatic access.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries for retrieving event clearing relationship data from the master.dynamic_app_event_clearing table. This cursor should be properly configured and connected to the database before calling this function.

  • event_ids – A set of integer event IDs representing the clearer events for which to retrieve existing cleared event relationships. These are the event IDs that perform the clearing action. An empty set will result in an empty mapping being returned without any database queries.

Returns:

A dictionary mapping clearer event IDs (integers) to lists of cleared event IDs (integers). Each key represents a clearer event ID from the input set, and the corresponding value is a list of event IDs that are currently configured to be cleared by that clearer event. Clearer events with no existing cleared events will have empty lists as their values.

Raises:

DatabaseExecutionError – Raised when the database query execution fails during the retrieval of existing event clearing relationships, as propagated from the underlying get_fields_from_table function.

lce_service.dynamic_app_api.retrieve_entities.get_powerpack_linkage_for_event_policies(dbc: silo_cursor, event_guids: Set[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)]]) → Dict[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)], Set[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)]]]

Retrieve PowerPack linkage information for Event Policies.

This function analyzes Event Policies to determine which PowerPacks they are associated with, either directly through their pp_guid field or indirectly through their parent Dynamic Applications. It creates a mapping of PowerPack GUIDs to the sets of Event Policy GUIDs that depend on them, which is useful for understanding PowerPack dependencies and impact analysis when making changes to PowerPacks.

The function handles two types of Event Policy associations: 1. Direct PowerPack association: Event Policies with a pp_guid field set 2. Indirect PowerPack association: Event Policies from Dynamic Applications that belong

to PowerPacks (source == DYNAMIC and app_guid is set)

Parameters:
  • dbc – A silo_cursor instance used to execute database queries for retrieving Event Policy and Dynamic Application data from the master database. This cursor should be properly configured and connected to the database before calling this function.

  • event_guids – A set of Event Policy GUIDs for which to determine PowerPack linkage. Each GUID should correspond to an existing Event Policy record in the database. The function will query additional database information about each policy’s PowerPack associations. An empty set will result in an empty mapping being returned without any database queries.

Returns:

A dictionary mapping PowerPack GUIDs to sets of Event Policy GUIDs that are associated with those PowerPacks. Each key represents a PowerPack GUID, and the corresponding value is a set of Event Policy GUIDs that depend on that PowerPack either directly or through their parent Dynamic Applications. PowerPacks with no associated Event Policies will not be included in the returned mapping.

Raises:

DatabaseExecutionError – Raised when any database query execution fails during the retrieval of Event Policy or Dynamic Application data, as propagated from the underlying database access functions.

lce_service.dynamic_app_api.retrieve_entities.get_presentations_for_dynamic_application(dbc: silo_cursor, app_id: int) → List[PresentationObject] | None

Retrieve and validate all Presentation objects associated with a Dynamic Application.

Parameters:
  • dbc – A silo_cursor instance used to execute the database query.

  • app_id – The ID of the Dynamic Application whose Presentation Objects should be retrieved.

Returns:

A list of validated PresentationObject model instances.

Raises:
  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when the database query fails.

lce_service.dynamic_app_api.retrieve_entities.get_snippets_for_dynamic_application(dbc: silo_cursor, app_id: int) → List[Snippet] | None

Retrieve and validate all Snippet objects associated with a Dynamic Application.

Parameters:
  • dbc – A silo_cursor instance used to execute the database query.

  • app_id – The ID of the Dynamic Application whose Snippets should be retrieved.

Returns:

A list of validated Snippet model instances.

Raises:
  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when the database query fails.

lce_service.dynamic_app_api.retrieve_entities.get_specified_fields_for_entities(dbc: silo_cursor, entity_guids: Set[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)]], model_info: EntityModelInformation, table: str, specified_fields: frozenset[str]) → Dict[Annotated[str, BeforeValidator(func=validate_guid, json_schema_input_type=PydanticUndefined)], Dict[str, Any]]

Retrieve values for specified fields for entities from the database.

Queries the database to fetch existing values for specified fields for entities identified by their GUIDs. This function is used to preserve data integrity by retrieving current field values that should not be modified through user input or payload updates. The retrieved values can then be used to populate missing fields in entity dictionaries to maintain consistency with stored data.

Parameters:
  • dbc – A silo_cursor instance used to execute database queries for retrieving entity field values from the specified table. This cursor should be properly configured and connected to the database before calling this function.

  • entity_guids – A set of entity GUIDs for which to retrieve logically dependent field values. Each GUID should correspond to an existing entity record in the specified table. If an empty set is provided, the function returns an empty dictionary without performing any database queries.

  • model_info – An EntityModelInformation instance containing the column mapping and other metadata for the entity type being processed. This provides the necessary information to construct database queries and map database columns to model fields, including the GUID column mapping.

  • table – The name of the database table from which to retrieve entity field values. This should be the table that stores the entity type being processed (e.g., dynamic_app table, collection_objects table, event_policies table).

  • specified_fields – A frozenset of field names that should be retrieved from the database.

Returns:

A dictionary mapping entity GUIDs to their corresponding field value dictionaries. Each key is an entity GUID from the input set that exists in the database, and the corresponding value is a dictionary containing the logically dependent field names as keys and their current database values as values. Entities that don’t exist in the database will not be included in the returned mapping. Returns an empty dictionary if no entity GUIDs are provided.

Raises:

DatabaseExecutionError – Raised when the database query execution fails during the retrieval of entity field values, as propagated from the underlying get_fields_from_table function.

lce_service.dynamic_app_api.retrieve_entities.get_thresholds_for_dynamic_application(dbc: silo_cursor, app_id: int) → List[ThresholdObject] | None

Retrieve and validate all Threshold objects associated with a Dynamic Application.

Parameters:
  • dbc – A silo_cursor instance used to execute the database query.

  • app_id – The ID of the Dynamic Application whose Threshold Objects should be retrieved.

Returns:

A list of validated ThresholdObject model instances.

Raises:
  • InvalidResourceError – Raised when the stored data fails a rule of its model that is not about a single field, such as the supported application types. Stored values that fail the validation of their field are kept and reported in validation_errors (see EnumLabelMixin.model_validate_stored).

  • DatabaseExecutionError – Raised when the database query fails.