ray.data.Dataset.schema#

Dataset.schema(fetch_if_missing: bool = True) Schema | None[source]#

Return the schema of the dataset.

Examples

>>> import ray
>>> ds = ray.data.range(10)
>>> ds.schema()
Column  Type
------  ----
id      int64

Note

If this dataset consists of more than a read, or if the schema can’t be determined from the metadata provided by the datasource, or if fetch_if_missing=True (the default), then this operation will trigger execution of the lazy transformations performed on this dataset.

Time complexity: O(1)

Parameters:

fetch_if_missing – If True, synchronously fetch the schema if it’s not known. If False, None is returned if the schema is not known. Default is True.

Returns:

The ray.data.Schema class of the records, or None if the schema is not known and fetch_if_missing is False.