paleolimbot commented on code in PR #431:
URL: https://github.com/apache/arrow-nanoarrow/pull/431#discussion_r1581712127


##########
python/src/nanoarrow/schema.py:
##########
@@ -108,10 +115,73 @@ def create(obj):
         return TimeUnit(obj)
 
 
+class ExtensionAccessor:
+    """Accessor for extension type parameters"""
+
+    def __init__(self, schema) -> None:
+        self._schema = schema
+
+    @property
+    def name(self) -> str:
+        """Extension name for this extension type"""
+        return self._schema._c_schema_view.extension_name
+
+    @property
+    def metadata(self) -> Union[bytes, None]:
+        """Extension metadata for this extension type if present"""
+        extension_metadata = self._schema._c_schema_view.extension_metadata
+        return extension_metadata if extension_metadata else None
+
+    @property
+    def storage(self):
+        """Storage type for this extension type"""
+        metadata = dict(self._schema.metadata.items())
+        del metadata[b"ARROW:extension:name"]
+        if b"ARROW:extension:metadata" in metadata:
+            del metadata[b"ARROW:extension:metadata"]

Review Comment:
   I added a comment! (Removing the metadata keys is required, or else the 
schema will still be treated as an extension).



-- 
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]

Reply via email to