tsa.group_find#

mainsource.group_find(query=None, limit=None, meta=False, sources=[], _source='local')#

Return a list of group descriptors matching the query.

A series descriptor is a string-like object (exhibiting the series name) with additional attributes. If meta has been set to True, the .meta (for normal metadata) and .imeta (for internal metadata) fields will be populated (non None). Lastly, the .source and .kind attributes provides the series source and kind.

Here is an example:

tsa.group_find(
   '(by.and '
   '  (by.tzaware)'
   '  (by.name "power capacity") '
   '  (by.metakey "plant")'
   '  (by.not (by.or '
   '    (by.metaitem "plant_type" "oil")'
   '    (by.metaitem "plant_type" "coal")))'
   '  (by.metaitem "unit" "mwh")'
   '  (by.metaitem "country" "fr"))'
)

The following filters can be used from the search module:

  • by.tzaware: no parameter, yields time zone aware series names

  • by.name <str>: takes a space separated string of word, yields series names containing the substrings (in order)

  • by.metakey <str>: takes a string, strictly matches all series having this metadata key

  • by.metaitems <str> <str-or-number>: takes a string (key) and an str (or numerical) value and yields all series strictly matching this metadata item

  • by.and: takes a variable number of filters as above to combine them

  • by.or: takes a variable number of filters as above to combine them

  • by.not: produce the negation of a filter

Also inequalities on metadata values can be used:

  • <, <=, >, >=, =: take a string key, a value (str or num)

As in (<= “max_capacity” 900)

Parameters:
  • query (str | None)

  • limit (int | None)

  • meta (int | None)

  • sources (List[str])

  • _source (str | None)

Return type:

List[ts]