Skip to content

Commit

Permalink
fix(duckdb): allow connection to motherduck via ibis.connect (#8357)
Browse files Browse the repository at this point in the history
## Description of changes

Our `_from_url` was a little aggressive in calling `Path().absolute()`
on targets. Since we already handle that in `duckdb.do_connect` we can
use `urlparse` to rip out the appropriate bits and forward them.


## Issues closed

Fixes #8355
  • Loading branch information
gforsyth committed Feb 15, 2024
1 parent 17be43a commit 42f45fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ibis/backends/base/__init__.py
Expand Up @@ -1433,9 +1433,14 @@ def _from_url(self, url: str, **kwargs) -> BaseBackend:
url = urlparse(url)
netloc = url.netloc
parts = list(filter(None, (netloc, url.path[bool(netloc) :])))
database = (
Path(*parts).absolute() if parts and parts != [":memory:"] else ":memory:"
)
database = Path(*parts) if parts and parts != [":memory:"] else ":memory:"
if (strdatabase := str(database)).startswith("md:") or strdatabase.startswith(
"motherduck:"
):
database = strdatabase
elif isinstance(database, Path):
database = database.absolute()

query_params = parse_qs(url.query)

for name, value in query_params.items():
Expand Down

0 comments on commit 42f45fe

Please sign in to comment.