lidavidm commented on code in PR #375:
URL: https://github.com/apache/arrow-adbc/pull/375#discussion_r1085244748
##########
python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py:
##########
@@ -38,8 +39,22 @@ def connect(
db_kwargs : dict, optional
Initial database connection parameters.
"""
- root = importlib.resources.files(__package__)
- entrypoint = root.joinpath("libadbc_driver_flightsql.so")
return adbc_driver_manager.AdbcDatabase(
- driver=str(entrypoint), uri=uri, **(db_kwargs or {})
+ driver=_driver_path(), uri=uri, **(db_kwargs or {})
)
+
+
[email protected]
+def _driver_path() -> str:
+ root = importlib.resources.files(__package__)
+ entrypoint = root.joinpath("libadbc_driver_flightsql.so")
+ if entrypoint.is_file():
+ return str(entrypoint)
+ is_conda = root.joinpath(".is_conda")
+ if is_conda.is_file():
+ with is_conda.open() as source:
+ return source.read().strip()
+ raise RuntimeError(f"Could not find driver, was {__package__} properly
installed?")
Review Comment:
Fair point. I'll switch this to search something like `sys.prefix + '/lib'`
which appears to be `$CONDA_PREFIX` or `/usr` on my Linux machine at least.
--
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]