Skip to content

Commit

Permalink
feat(api): ibis.connect() default to duckdb for parquet/csv extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
saulpw authored and cpcloud committed Jul 5, 2022
1 parent e13946b commit ff2f088
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ibis/backends/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,3 +686,24 @@ def _(
con = getattr(ibis, backend).connect(**kwargs)
con.register(f"{extension}://{filename}")
return con


@_connect.register(
r"(?P<filename>.+\.(?P<extension>parquet|csv))",
priority=8,
)
def _(
_: str,
*,
filename: str,
extension: str,
**kwargs: Any,
) -> BaseBackend:
"""Connect to `duckdb` and register a parquet or csv file.
Examples
--------
>>> con = ibis.connect("relative/path/to/data.csv")
>>> con = ibis.connect("relative/path/to/more/data.parquet")
"""
return _connect(f"duckdb://{filename}", **kwargs)

0 comments on commit ff2f088

Please sign in to comment.