Args: proto_only: If True, return raw protobuf objects without calling from_proto(). Used by proto() to build the RegistryProto cache efficiently — avoids the from_proto()/to_proto() round-trip and works uniformly for all object ty
(
self,
table: Table,
project: str,
proto_class: Any,
python_class: Any,
proto_field_name: str,
tags: Optional[dict[str, str]] = None,
proto_only: bool = False,
skip_udf: bool = False,
)
| 1579 | return None |
| 1580 | |
| 1581 | def _list_objects( |
| 1582 | self, |
| 1583 | table: Table, |
| 1584 | project: str, |
| 1585 | proto_class: Any, |
| 1586 | python_class: Any, |
| 1587 | proto_field_name: str, |
| 1588 | tags: Optional[dict[str, str]] = None, |
| 1589 | proto_only: bool = False, |
| 1590 | skip_udf: bool = False, |
| 1591 | ): |
| 1592 | """ |
| 1593 | Args: |
| 1594 | proto_only: If True, return raw protobuf objects without calling |
| 1595 | from_proto(). Used by proto() to build the RegistryProto cache |
| 1596 | efficiently — avoids the from_proto()/to_proto() round-trip and |
| 1597 | works uniformly for all object types (entities, data sources, etc.). |
| 1598 | skip_udf: If True, call from_proto() but skip deserializing UDFs |
| 1599 | (dill.loads). Returns Python objects suitable for filtering and |
| 1600 | display without requiring the UDF's source module to be installed. |
| 1601 | Only relevant for feature view types that contain UDFs. |
| 1602 | """ |
| 1603 | import inspect |
| 1604 | |
| 1605 | supports_skip_udf = ( |
| 1606 | skip_udf |
| 1607 | and "skip_udf" in inspect.signature(python_class.from_proto).parameters |
| 1608 | ) |
| 1609 | |
| 1610 | with self.read_engine.begin() as conn: |
| 1611 | stmt = select(table).where(table.c.project_id == project) |
| 1612 | rows = conn.execute(stmt).all() |
| 1613 | if rows: |
| 1614 | objects = [] |
| 1615 | for row in rows: |
| 1616 | proto = proto_class.FromString(row._mapping[proto_field_name]) |
| 1617 | if proto_only: |
| 1618 | objects.append(proto) |
| 1619 | else: |
| 1620 | obj = ( |
| 1621 | python_class.from_proto(proto, skip_udf=True) |
| 1622 | if supports_skip_udf |
| 1623 | else python_class.from_proto(proto) |
| 1624 | ) |
| 1625 | if utils.has_all_tags(obj.tags, tags): |
| 1626 | objects.append(obj) |
| 1627 | return objects |
| 1628 | return [] |
| 1629 | |
| 1630 | def _set_last_updated_metadata( |
| 1631 | self, last_updated: datetime, project: str, conn=None |
no test coverage detected