james-willis commented on code in PR #1124:
URL: https://github.com/apache/sedona-db/pull/1124#discussion_r3723889464
##########
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:
theres no risk that pyorgio isnt installed in the python runtime?
I have a hard time remembering what is and is not expected to be installed.
--
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]