# Channel

## class nominal.core.Channel(name, data_source, data_type, unit, description)

Bases: `RefreshableGrpcMixin`[`ChannelMetadata`]

Metadata for working with channels.

### name: str

### data_source: str

### data_type: ChannelDataType | None

### unit: str | None

### description: str | None

### get_available_tags(start_time=None, end_time=None, initial_tags=None)

Return available tag key-values for the channel over the given time period

Parameters:
:   - **start_time** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* [*datetime*](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.15)") *|* [*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") *|* *None*)

      Start time to start scanning for tags from (defaults to the beginning of time)
    - **end_time** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* [*datetime*](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.15)") *|* [*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") *|* *None*)

      End time to stop scanning for tags until (defaults to the end of time)
    - **initial_tags** ([*Mapping*](https://docs.python.org/3/library/typing.html#typing.Mapping "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]* *|* *None*)

      Initial tags to filter results by

Returns:
:   Mapping of all tag names to all tag values present

Return type:
:   [*Mapping*](https://docs.python.org/3/library/typing.html#typing.Mapping "(in Python v3.15)")[[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)"), [*set*](https://docs.python.org/3/builtins/stdtypes.html#set "(in Python v3.15)")[[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")]]

Example

Given data with the following tags per-point within the specified time range:

```python
{"tag_a": "123", "tag_b": "xyz"}
{"tag_a": "123", "tag_b": "abc"}
{"tag_a": "234", "tag_b": "qqq"}
```

With an initial filter of `{"tag_a": "123"}`, we would return:

```python
{"tag_a": set(["123"]), "tag_b": set(["abc", "xyz"])}
```

Because we filtered data to only include data where “tag_a” is “123”

> **Note**
>
> It is not accurate to say that the cartesian product of all returned tag key-value pairs
> is present in the data, only that for each unique key-value pair present, that specific tag key/value
> pair is present on *at least* one point in the data.

> **Note**
>
> This may be used to determine if the given set of initial tags *fully constrains* data in a channel over
> a given timespan by checking to see if the length of all of the tag-value sets is 1.

### refresh()

Return type:
:   [*Self*](https://docs.python.org/3/library/typing.html#typing.Self "(in Python v3.15)")

### search_logs(*, tags: Mapping[str, str] | None = None, regex_match: str, start: str | datetime | int | None = None, end: str | datetime | int | None = None) → Iterable[LogPoint]

### search_logs(*, tags: Mapping[str, str] | None = None, insensitive_match: str, start: str | datetime | int | None = None, end: str | datetime | int | None = None) → Iterable[LogPoint]

### search_logs(*, tags: Mapping[str, str] | None = None, start: str | datetime | int | None = None, end: str | datetime | int | None = None) → Iterable[LogPoint]

Yields logpoints from the current channel that match the provided arguments

Parameters:
:   - **regex_match** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      If provided, a regex match to filter potential log messages by.

      **Note:** Must not be present with `insensitive_match`.
    - **insensitive_match** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      If provided, a case insensitive string that yielded logs match exactly.

      **Note:** Must not be present with `regex_match`.
    - **tags** ([*Mapping*](https://docs.python.org/3/library/typing.html#typing.Mapping "(in Python v3.15)")*[*[*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*,* [*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)")*]* *|* *None*)

      Tags to filter logs from the channel with
    - **start** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* [*datetime*](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.15)") *|* [*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") *|* *None*)

      Timestamp to start yielding results from. If not present, searches starting from unix epoch
    - **end** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* [*datetime*](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.15)") *|* [*int*](https://docs.python.org/3/builtins/functions.html#int "(in Python v3.15)") *|* *None*)

      Timestamp after which to stop yielding results from. If not present, searches until end of time.

Return type:
:   [*Iterable*](https://docs.python.org/3/library/typing.html#typing.Iterable "(in Python v3.15)")[[*LogPoint*](https://dev.nominal.io/python/ref/generated/nominal.core.LogPoint.md#nominal.core.LogPoint "nominal.core.log.LogPoint")]

### update(*, description=None, unit=_NotProvided())

Replace channel metadata within Nominal, and updates / returns the local instance.

Only the metadata passed in will be replaced, the rest will remain untouched.

Parameters:
:   - **description** ([*str*](https://docs.python.org/3/builtins/stdtypes.html#str "(in Python v3.15)") *|* *None*)

      Human-readable description of data within the channel
    - **unit** ([*UnitLike*](https://dev.nominal.io/python/ref/core/channels-and-units.md#nominal.core.UnitLike "nominal.core.UnitLike") *|* *_NotProvided*)

      Unit symbol to apply to the channel. If unit is a string or a [`Unit`](https://dev.nominal.io/python/ref/generated/nominal.core.Unit.md#nominal.core.Unit "nominal.core.Unit"), this will update the unit symbol
      for the channel. If unit is None, this will clear the unit symbol for the channel. If not provided (or
      `_NotProvided`), this will leave the unit unaffected.

      **Note:** This is in contrast to other fields in other [`update()`](https://dev.nominal.io/python/ref/generated/nominal.core.Channel.md#nominal.core.Channel.update "nominal.core.Channel.update") calls where [`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)") is treated as a
      “no-op”.

Return type:
:   *Self*
