Skip to content

Commit

Permalink
fix(postgres): pass through additional kwargs in pguri
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored and jcrist committed Feb 13, 2024
1 parent 05575b7 commit 7ab4fda
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ibis/backends/postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def do_connect(
port: int = 5432,
database: str | None = None,
schema: str | None = None,
**kwargs: Any,
) -> None:
"""Create an Ibis client connected to PostgreSQL database.
Expand All @@ -224,6 +225,8 @@ def do_connect(
Database to connect to
schema
PostgreSQL schema to use. If `None`, use the default `search_path`.
kwargs
Additional keyword arguments to pass to the backend client connection.
Examples
--------
Expand Down Expand Up @@ -265,6 +268,7 @@ def do_connect(
password=password,
database=database,
options=(f"-csearch_path={schema}" * (schema is not None)) or None,
**kwargs,
)

with self.begin() as cur:
Expand Down
7 changes: 7 additions & 0 deletions ibis/backends/postgres/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,10 @@ def test_timezone_from_column(contz, snapshot):
)
tm.assert_frame_equal(result, expected)
snapshot.assert_match(ibis.to_sql(case), "out.sql")


def test_kwargs_passthrough_in_connect():
con = ibis.connect(
"postgresql://postgres:postgres@localhost/ibis_testing?sslmode=allow"
)
assert con.current_database == "ibis_testing"

0 comments on commit 7ab4fda

Please sign in to comment.