paleolimbot commented on code in PR #1124:
URL: https://github.com/apache/sedona-db/pull/1124#discussion_r3723816739


##########
python/sedonadb/python/sedonadb/context.py:
##########
@@ -121,8 +128,31 @@ def _impl(self):
             impl = InternalContext(opts)
             self.__impl = impl
             self.options.freeze_runtime()
+            self._register_default_formats()
         return self.__impl
 
+    def _register_default_formats(self):
+        """Auto-register the built-in single-file OGR formats.
+
+        This makes `SELECT * FROM 'file:///path/to/data.<ext>'` work
+        zero-config for the common pyogrio/GDAL formats, matching the way
+        Parquet is handled. pyogrio is an optional dependency, so this is a
+        no-op when it is not installed (the availability check does not import
+        pyogrio, which keeps context creation cheap and side-effect free).
+        """
+        try:
+            pyogrio_available = importlib.util.find_spec("pyogrio") is not None
+        except (ImportError, ValueError):
+            pyogrio_available = False
+
+        if not pyogrio_available:
+            return
+
+        from sedonadb.datasource import PyogrioFormatSpec
+
+        for extension in _DEFAULT_PYOGRIO_EXTENSIONS:
+            self.register(PyogrioFormatSpec(extension))

Review Comment:
   I *think* that pyogrio isn't imported until you actually open a file (so you 
should be able to just go ahead and register).



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