Skip to main content

system.kanoa.quality.config.addDataSource

This function requires KanoaQDS module

Description

Adds a new attribute datasource in KanoaQDS. Catches the Java exception if this datasource already exists for this attributeId/assetId combo.

Syntax

addDataSource(attrInfo, userId)
  • Parameters
      dict attrInfo - Dictionary, e.g., {'attributeId': 3, 'assetId': 5, 'sourceTagPath': 'some tag path', 'scaleFactor': 1.0, 'ignoreZeroValues': True, 'enabled': True}
      int userId - User ID
  • Returns
      int attributeDataSourceId - ID of the added attribute datasource.
      str msg - Message indicating the result of the addition.
  • Code Examples

    # Usage example
    attr_info = {'attributeId': 3, 'assetId': 5, 'sourceTagPath': 'some tag path', 'scaleFactor': 1.0, 'ignoreZeroValues': True, 'enabled': True}
    added_attr_datasource_id, add_msg = system.kanoa.quality.config.addDataSource(attrInfo=attr_info, userId=123)

    if added_attr_datasource_id is not None:
    print(f"Successfully added attribute datasource with ID {added_attr_datasource_id}")
    else:
    print(f"Addition failed. Error: {add_msg}")