Skip to content

Schema

arro3.core.Schema

A Python-facing Arrow schema.

This is a wrapper around a [SchemaRef].

metadata

metadata: dict[bytes, bytes] = <attribute 'metadata' of 'arro3.core._core.Schema' objects>

metadata_str

metadata_str: dict[str, str] = <attribute 'metadata_str' of 'arro3.core._core.Schema' objects>

names

names: list[str] = <attribute 'names' of 'arro3.core._core.Schema' objects>

types

types: list[DataType] = <attribute 'types' of 'arro3.core._core.Schema' objects>

__arrow_c_schema__ method descriptor

__arrow_c_schema__() -> object

An implementation of the Arrow PyCapsule Interface. This dunder method should not be called directly, but enables zero-copy data transfer to other Python libraries that understand Arrow memory.

For example, you can call pyarrow.schema() to convert this array into a pyarrow schema, without copying memory.

Returns:

append method descriptor

append(field: ArrowSchemaExportable) -> Schema

Append a field at the end of the schema.

In contrast to Python's list.append() it does return a new object, leaving the original Schema unmodified.

Parameters:

Returns:

empty_table method descriptor

empty_table() -> Table

Provide an empty table according to the schema.

Returns:

equals method descriptor

equals(other: ArrowSchemaExportable) -> bool

Test if this schema is equal to the other

Parameters:

Returns:

  • bool

    description

field method descriptor

field(i: int | str) -> Field

Select a field by its column name or numeric index.

Parameters:

Returns:

from_arrow builtin

from_arrow(input: ArrowSchemaExportable) -> Schema

Construct this from an existing Arrow object

Parameters:

Returns:

from_arrow_pycapsule builtin

from_arrow_pycapsule(capsule) -> Schema

Construct this object from a bare Arrow PyCapsule

get_all_field_indices method descriptor

get_all_field_indices(name: str) -> list[int]

Return sorted list of indices for the fields with the given name.

Parameters:

  • name (str) –

    description

Returns:

get_field_index method descriptor

get_field_index(name: str) -> int

Return index of the unique field with the given name.

Parameters:

  • name (str) –

    description

Returns:

  • int

    description

insert method descriptor

insert(i: int, field: ArrowSchemaExportable) -> Schema

Add a field at position i to the schema.

Parameters:

Returns:

remove method descriptor

remove(i: int) -> Schema

Remove the field at index i from the schema.

Parameters:

  • i (int) –

    description

Returns:

remove_metadata method descriptor

remove_metadata() -> Schema

Create new schema without metadata, if any

Returns:

set method descriptor

set(i: int, field: ArrowSchemaExportable) -> Schema

Replace a field at position i in the schema.

Parameters:

Returns:

with_metadata method descriptor

with_metadata(metadata: dict[str, str] | dict[bytes, bytes]) -> Schema

Add metadata as dict of string keys and values to Schema.

Parameters:

Returns: