types
Data types used in describing Iceberg schemas.
This module implements the data types described in the Iceberg specification for Iceberg schemas. To describe an Iceberg table schema, these classes can be used in the construction of a StructType instance.
Example
str(StructType( ... NestedField(1, "required_field", StringType(), True), ... NestedField(2, "optional_field", IntegerType()) ... )) 'struct<1: required_field: optional string, 2: optional_field: optional int>'
Notes
- https://iceberg.apache.org/#spec/#primitive-types
BinaryType
Bases: PrimitiveType
A Binary data type in Iceberg can be represented using an instance of this class.
Binaries in Iceberg are arbitrary-length byte arrays.
Example
column_foo = BinaryType() isinstance(column_foo, BinaryType) True column_foo BinaryType()
Source code in pyiceberg/types.py
BooleanType
Bases: PrimitiveType
A boolean data type in Iceberg can be represented using an instance of this class.
Example
column_foo = BooleanType() isinstance(column_foo, BooleanType) True column_foo BooleanType()
Source code in pyiceberg/types.py
DateType
Bases: PrimitiveType
A Date data type in Iceberg can be represented using an instance of this class.
Dates in Iceberg are calendar dates without a timezone or time.
Example
column_foo = DateType() isinstance(column_foo, DateType) True column_foo DateType()
Source code in pyiceberg/types.py
DecimalType
Bases: PrimitiveType
A decimal data type in Iceberg.
Example
DecimalType(32, 3) DecimalType(precision=32, scale=3) DecimalType(8, 3) == DecimalType(8, 3) True
Source code in pyiceberg/types.py
precision: int
property
Return the precision of the decimal.
scale: int
property
Return the scale of the decimal.
__eq__(other)
__getnewargs__()
__hash__()
__repr__()
__str__()
DoubleType
Bases: PrimitiveType
A Double data type in Iceberg can be represented using an instance of this class.
Doubles in Iceberg are 64-bit IEEE 754 floating points.
Example
column_foo = DoubleType() isinstance(column_foo, DoubleType) True column_foo DoubleType()
Source code in pyiceberg/types.py
FixedType
Bases: PrimitiveType
A fixed data type in Iceberg.
Example
FixedType(8) FixedType(length=8) FixedType(8) == FixedType(8) True FixedType(19) == FixedType(25) False
Source code in pyiceberg/types.py
__getnewargs__()
__len__()
__repr__()
FloatType
Bases: PrimitiveType
A Float data type in Iceberg can be represented using an instance of this class.
Floats in Iceberg are 32-bit IEEE 754 floating points and can be promoted to Doubles.
Example
column_foo = FloatType() isinstance(column_foo, FloatType) True column_foo FloatType()
Attributes:
Name | Type | Description |
---|---|---|
max |
float
|
The maximum allowed value for Floats, inherited from the canonical Iceberg implementation
in Java. (returns |
min |
float
|
The minimum allowed value for Floats, inherited from the canonical Iceberg implementation
in Java (returns |
Source code in pyiceberg/types.py
IcebergType
Bases: IcebergBaseModel
Base type for all Iceberg Types.
Example
str(IcebergType()) 'IcebergType()' repr(IcebergType()) 'IcebergType()'
Source code in pyiceberg/types.py
IntegerType
Bases: PrimitiveType
An Integer data type in Iceberg can be represented using an instance of this class.
Integers in Iceberg are 32-bit signed and can be promoted to Longs.
Example
column_foo = IntegerType() isinstance(column_foo, IntegerType) True
Attributes:
Name | Type | Description |
---|---|---|
max |
int
|
The maximum allowed value for Integers, inherited from the canonical Iceberg implementation
in Java (returns |
min |
int
|
The minimum allowed value for Integers, inherited from the canonical Iceberg implementation
in Java (returns |
Source code in pyiceberg/types.py
ListType
Bases: IcebergType
A list type in Iceberg.
Example
ListType(element_id=3, element_type=StringType(), element_required=True) ListType(element_id=3, element_type=StringType(), element_required=True)
Source code in pyiceberg/types.py
__eq__(other)
__getnewargs__()
__hash__()
LongType
Bases: PrimitiveType
A Long data type in Iceberg can be represented using an instance of this class.
Longs in Iceberg are 64-bit signed integers.
Example
column_foo = LongType() isinstance(column_foo, LongType) True column_foo LongType() str(column_foo) 'long'
Attributes:
Name | Type | Description |
---|---|---|
max |
int
|
The maximum allowed value for Longs, inherited from the canonical Iceberg implementation
in Java. (returns |
min |
int
|
The minimum allowed value for Longs, inherited from the canonical Iceberg implementation
in Java (returns |
Source code in pyiceberg/types.py
MapType
Bases: IcebergType
A map type in Iceberg.
Example
MapType(key_id=1, key_type=StringType(), value_id=2, value_type=IntegerType(), value_required=True) MapType(key_id=1, key_type=StringType(), value_id=2, value_type=IntegerType(), value_required=True)
Source code in pyiceberg/types.py
__eq__(other)
Compare the MapType to another object.
__getnewargs__()
__hash__()
NestedField
Bases: IcebergType
Represents a field of a struct, a map key, a map value, or a list element.
This is where field IDs, names, docs, and nullability are tracked.
Example
str(NestedField( ... field_id=1, ... name='foo', ... field_type=FixedType(22), ... required=False, ... )) '1: foo: optional fixed[22]' str(NestedField( ... field_id=2, ... name='bar', ... field_type=LongType(), ... is_optional=False, ... doc="Just a long" ... )) '2: bar: required long (Just a long)'
Source code in pyiceberg/types.py
__getnewargs__()
__str__()
Return the string representation of the NestedField class.
Source code in pyiceberg/types.py
PrimitiveType
Bases: IcebergRootModel[str]
, IcebergType
, Singleton
Base class for all Iceberg Primitive Types.
Source code in pyiceberg/types.py
__repr__()
StringType
Bases: PrimitiveType
A String data type in Iceberg can be represented using an instance of this class.
Strings in Iceberg are arbitrary-length character sequences and are encoded with UTF-8.
Example
column_foo = StringType() isinstance(column_foo, StringType) True column_foo StringType()
Source code in pyiceberg/types.py
StructType
Bases: IcebergType
A struct type in Iceberg.
Example
str(StructType( ... NestedField(1, "required_field", StringType(), True), ... NestedField(2, "optional_field", IntegerType()) ... )) 'struct<1: required_field: optional string, 2: optional_field: optional int>'
Source code in pyiceberg/types.py
__eq__(other)
__getnewargs__()
__hash__()
__len__()
__repr__()
TimeType
Bases: PrimitiveType
A Time data type in Iceberg can be represented using an instance of this class.
Times in Iceberg have microsecond precision and are a time of day without a date or timezone.
Example
column_foo = TimeType() isinstance(column_foo, TimeType) True column_foo TimeType()
Source code in pyiceberg/types.py
TimestampType
Bases: PrimitiveType
A Timestamp data type in Iceberg can be represented using an instance of this class.
Timestamps in Iceberg have microsecond precision and include a date and a time of day without a timezone.
Example
column_foo = TimestampType() isinstance(column_foo, TimestampType) True column_foo TimestampType()
Source code in pyiceberg/types.py
TimestamptzType
Bases: PrimitiveType
A Timestamptz data type in Iceberg can be represented using an instance of this class.
Timestamptzs in Iceberg are stored as UTC and include a date and a time of day with a timezone.
Example
column_foo = TimestamptzType() isinstance(column_foo, TimestamptzType) True column_foo TimestamptzType()
Source code in pyiceberg/types.py
UUIDType
Bases: PrimitiveType
A UUID data type in Iceberg can be represented using an instance of this class.
UUIDs in Iceberg are universally unique identifiers.
Example
column_foo = UUIDType() isinstance(column_foo, UUIDType) True column_foo UUIDType()