Data Types

tecton_client.data_types module

class tecton_client.data_types.ArrayType(element_type: DataType)[source]

Bases: DataType

Class to represent datatype Array.

An ArrayType object represents an array datatype that can contain elements of another DataType.

Examples

>>> element_type = FloatType()
>>> array_type = ArrayType(element_type)
>>> print(array_type)
Array(Float)
property element_type: DataType

Return the DataType of the elements in the array.

class tecton_client.data_types.BoolType[source]

Bases: DataType

Class to represent datatype Boolean.

class tecton_client.data_types.DataType[source]

Bases: ABC

Base DataType class. All data types inherit from this class.

class tecton_client.data_types.FloatType[source]

Bases: DataType

Class to represent datatype Float.

class tecton_client.data_types.IntType[source]

Bases: DataType

Class to represent datatype Integer.

class tecton_client.data_types.NameAndType(name: str, data_type: DataType)[source]

Bases: object

Class to represent a name and data type pair.

data_type: DataType
name: str
class tecton_client.data_types.StringType[source]

Bases: DataType

Class to represent datatype String.

class tecton_client.data_types.StructField(name: str, data_type: DataType)[source]

Bases: object

Class to represent a field in a StructType.

A StructField object represents a field within a StructType object, containing a name and a corresponding DataType.

property data_type: DataType

Return the DataType of the field.

property name: str

Return the name of the field.

class tecton_client.data_types.StructType(fields: List[StructField])[source]

Bases: DataType

Class to represent datatype Struct.

A StructType object represents a struct datatype, consisting of multiple fields.

Examples

>>> field1 = StructField("name", StringType())
>>> field2 = StructField("age", IntType())
>>> struct_type = StructType([field1, field2])
>>> print(struct_type)
Struct(Field(name, String), Field(age, Int))
property fields: List[StructField]

Return the list of StructField objects representing the fields in the struct.

tecton_client.data_types.get_data_type(data_type: str, element_type: dict | None = None, fields: list | None = None) DataType[source]

Get the DataType of the feature value given a string representing the type in the response.

Parameters:
  • data_type (str) – A string representing the type of the feature value, as returned in the response.

  • element_type (Optional[dict]) – A dict representing the type of the elements in the array, present when the data_type is ArrayType.

  • fields (Optional[list]) – A list representing the fields of the struct, present when the data_type is StructType

Returns:

The parsed DataType of the feature value.

Return type:

DataType

Raises:

TectonClientError – If an unexpected error occurred while processing the data types in the response.

DataType()

Base DataType class.

IntType()

Class to represent datatype Integer.

FloatType()

Class to represent datatype Float.

StringType()

Class to represent datatype String.

BoolType()

Class to represent datatype Boolean.

ArrayType(element_type)

Class to represent datatype Array.

StructField(name, data_type)

Class to represent a field in a StructType.

StructType(fields)

Class to represent datatype Struct.

NameAndType(name, data_type)

Class to represent a name and data type pair.