MCPcopy Index your code
hub / github.com/feast-dev/feast / to_proto

Method to_proto

sdk/python/feast/field.py:120–145  ·  view source on GitHub ↗

Converts a Field object to its protobuf representation.

(self)

Source from the content-addressed store, hash-verified

118 return f"Field(name={self.name}, dtype={self.dtype}, tags={self.tags})"
119
120 def to_proto(self) -> FieldProto:
121 """Converts a Field object to its protobuf representation."""
122 from feast.types import Array, Set
123
124 value_type = self.dtype.to_value_type()
125 vector_search_metric = self.vector_search_metric or ""
126 tags = dict(self.tags)
127 # Persist Struct field schema in tags
128 if isinstance(self.dtype, Struct):
129 tags[STRUCT_SCHEMA_TAG] = _serialize_struct_schema(self.dtype)
130 elif isinstance(self.dtype, Array) and isinstance(self.dtype.base_type, Struct):
131 tags[STRUCT_SCHEMA_TAG] = _serialize_struct_schema(self.dtype.base_type)
132 # Persist nested collection type info in tags
133 if isinstance(self.dtype, (Array, Set)) and isinstance(
134 self.dtype.base_type, (Array, Set)
135 ):
136 tags[NESTED_COLLECTION_INNER_TYPE_TAG] = _feast_type_to_str(self.dtype)
137 return FieldProto(
138 name=self.name,
139 value_type=value_type.value, # type: ignore[arg-type]
140 description=self.description,
141 tags=tags,
142 vector_index=self.vector_index,
143 vector_length=self.vector_length,
144 vector_search_metric=vector_search_metric,
145 )
146
147 @classmethod
148 def from_proto(cls, field_proto: FieldProto):

Callers 15

planMethod · 0.45
__init__Method · 0.45
to_registry_protoMethod · 0.45
GetEntityMethod · 0.45
ListEntitiesMethod · 0.45
GetDataSourceMethod · 0.45
ListDataSourcesMethod · 0.45
GetFeatureViewMethod · 0.45

Calls 3

_serialize_struct_schemaFunction · 0.85
_feast_type_to_strFunction · 0.85
to_value_typeMethod · 0.45