Skip to content

Commit

Permalink
docs(trino): add connection docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 31, 2023
1 parent cf5fdb9 commit 507a00e
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion ibis/backends/trino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,46 @@ def do_connect(
source: str | None = None,
**connect_args,
) -> None:
"""Create an Ibis client connected to a Trino database."""
"""Connect to Trino.
Parameters
----------
user
Username to connect with
password
Password to connect with
host
Hostname of the Trino server
port
Port of the Trino server
database
Catalog to use on the Trino server
schema
Schema to use on the Trino server
source
Application name passed to Trino
connect_args
Additional keyword arguments passed directly to SQLAlchemy's
`create_engine`
Examples
--------
>>> catalog = "hive"
>>> schema = "default"
Connect using a URL, with the default user, password, host and port
>>> con = ibis.connect(f"trino:///{catalog}/{schema}")
Connect using a URL
>>> con = ibis.connect(f"trino://user:password@host:port/{catalog}/{schema}")
Connect using keyword arguments
>>> con = ibis.trino.connect(database=catalog, schema=schema)
>>> con = ibis.trino.connect(database=catalog, schema=schema, source="my-app")
"""
database = "/".join(filter(None, (database, schema)))
url = sa.engine.URL.create(
drivername="trino",
Expand Down

0 comments on commit 507a00e

Please sign in to comment.