Select Signals
- pyclarify.client.Client.select_signals(filter={}, skip: int = 0, limit: Optional[int] = 20, sort: List[str] = [], total: Optional[bool] = False, include: Optional[List] = [], integration: str = None) pyclarify.views.generics.Response
Return signal metadata from selected signals and/or item.
- Parameters
filter (Filter, optional) – A Filter Model that describes a mongodb filter to be applied.
skip (int, default 0) – Integer describing how many of the first N items to exclude from response.
limit (int, default 10) – Number of items to include in the match.
sort (list of strings) – List of strings describing the order in which to sort the items in the response.
total (bool, default False) – When true, force the inclusion of a total count in the response. A total count is the total number of resources that matches filter.
include (List of strings, optional) – A list of strings specifying which relationships to be included in the response.
integration (str Default None) – Integration ID in string format. None means using the integration in credential file.
- Returns
Response.result.data
is an array of SignalSelectView- Return type
Response
Examples
>>> client = Client("./clarify-credentials.json")
Querying signals based on a filter.
>>> client.select_signals( ... filter = Filter(fields={"name": filter.NotEqual(value="Air Temperature")}), ... )
Getting 1000 signals.
>>> client.select_signals( ... limit = 1000, ... )
Getting 100 signals and sorting by name.
>>> client.select_signals( ... limit = 100, ... sort = ["name"], ... )
Getting total number of signals (as meta data) and including the exposed items.
>>> client.select_signals( ... total= True, ... include = ["item"] ... )
- Response
In case of a valid return value, returns a pydantic model with the following format:
>>> jsonrpc='2.0' ... id='1' ... result=Selection( ... meta=SelectionMeta( ... total=725, ... groupIncludedByType=True ... ), ... data=[ ... SignalSelectView( ... id='c5fg083sab1b6pm3u290', ... type='signals', ... meta=ResourceMetadata( ... annotations={ ... "docs-clarify-io/example/environment": "office" ... }, ... attributesHash='9ae4eb17c8b3b9f24cea06f09a1a4cab34569077', ... relationshipsHash='02852897e7fe1e7896360b3c3914c5207d2af6fa', ... updatedAt=datetime.datetime(2022, 3, 17, 12, 17, 10, 199000, tzinfo=datetime.timezone.utc), ... createdAt=datetime.datetime(2021, 10, 7, 14, 11, 44, 897000, tzinfo=datetime.timezone.utc) ... ), ... attributes=SavedSignal( ... name='Total reams of paper', ... description='Total count of reams of paper in inventory', ... labels={ ... 'type': ['Recycled', 'Bond'], ... 'location': ['Scranton'] ... }, ... sourceType=<SourceTypeSignal.measurement: 'measurement'>, ... valueType=<TypeSignal.numeric: 'numeric'>, ... engUnit='', ... enumValues={}, ... sampleInterval=None, ... gapDetection=None, ... input='inventory_recycled_bond', ... integration=None, ... item=None ... ), ... relationships=RelationshipsDict( ... integration=RelationshipData( ... data=RelationshipMetadata( ... type='integrations', ... id='c5e3u8coh8drsbpi4cvg' ... ) ... ), ... item=RelationshipData(data=None) ... ) ... ), ... ... ... ], ... included=IncludedField( ... integration=None, ... items=[ ... ItemSelectView( ... id='c5i41fjsbu8cohpkcpvg', ... type='items', ... meta=ResourceMetadata( ... annotations={ ... "docs-clarify-io/example/environment": "office" ... }, ... attributesHash='7602afa2fe611e0c8eff17f7936e108ee29e6817', ... relationshipsHash='5f36b2220a14b54ee5ea290645ee34d943ea5be5', ... updatedAt=datetime.datetime(2022, 3, 25, 9, 58, 20, 264000, tzinfo=datetime.timezone.utc), ... createdAt=datetime.datetime(2021, 10, 11, 13, 48, 46, 958000, tzinfo=datetime.timezone.utc) ... ), ... attributes=Item( ... name='Dunder ReBond Inventory Level', ... valueType=<TypeSignal.numeric: 'numeric'>, ... description='How many reams of the Dunder ReBond we have in the warehouse.', ... labels={ ... 'type': ['Recycled', 'Bond'], ... 'location': ['Scranton'], ... 'threat-level': ['Midnight'] ... }, ... engUnit='', ... enumValues={}, ... sourceType=<SourceTypeSignal.measurement: 'measurement'>, ... sampleInterval=None, ... gapDetection=datetime.timedelta(seconds=7200), ... visible=True ... ) ... ) ... ... ... ] ... ) ... ) ... error=None
In case of the error the method return a pydantic model with the following format:
>>> jsonrpc = '2.0' ... id = '1' ... result = None ... error = Error( ... code = '-32602', ... message = 'Invalid params', ... data = ErrorData(trace = <trace_id>, params = {}) ... )