rambleraptor commented on code in PR #3338:
URL: https://github.com/apache/iceberg-python/pull/3338#discussion_r3230362045


##########
pyiceberg/view/__init__.py:
##########
@@ -42,6 +42,46 @@ def name(self) -> Identifier:
         """Return the identifier of this view."""
         return self._identifier
 
+    def schema(self) -> Schema:
+        """Return the schema for this view."""
+        return next(schema for schema in self.metadata.schemas if 
schema.schema_id == self.current_version().schema_id)
+
+    def schemas(self) -> dict[int, Schema]:
+        """Return the schemas for this view."""
+        return {schema.schema_id: schema for schema in self.metadata.schemas}
+
+    def current_version(self) -> ViewVersion:
+        """Get the version of this view."""
+        return next(version for version in self.metadata.versions if 
version.version_id == self.metadata.current_version_id)
+
+    def versions(self) -> list[ViewVersion]:
+        """Get the versions of this view."""
+        return self.metadata.versions
+
+    def version(self, version_id: int) -> ViewVersion:
+        """Get the version in this view by ID."""
+        return next(version for version in self.metadata.versions if 
version.version_id == version_id)
+
+    def history(self) -> list[ViewHistoryEntry]:
+        """Get the version of this history view."""
+        return self.metadata.version_log
+
+    def properties(self) -> dict[str, str]:

Review Comment:
   We should use `@property` to match Table.



##########
pyiceberg/view/__init__.py:
##########
@@ -42,6 +42,46 @@ def name(self) -> Identifier:
         """Return the identifier of this view."""
         return self._identifier
 
+    def schema(self) -> Schema:
+        """Return the schema for this view."""
+        return next(schema for schema in self.metadata.schemas if 
schema.schema_id == self.current_version().schema_id)
+
+    def schemas(self) -> dict[int, Schema]:
+        """Return the schemas for this view."""
+        return {schema.schema_id: schema for schema in self.metadata.schemas}
+
+    def current_version(self) -> ViewVersion:
+        """Get the version of this view."""
+        return next(version for version in self.metadata.versions if 
version.version_id == self.metadata.current_version_id)
+
+    def versions(self) -> list[ViewVersion]:

Review Comment:
   @property



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to