Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 3071113

Browse files
committed
Add example to docstring (Issue #261)
1 parent 80bbccb commit 3071113

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

data_diff/databases/connect.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ def connect(db_conf: Union[str, dict], thread_count: Optional[int] = 1) -> Datab
184184
185185
Configuration can be given either as a URI string, or as a dict of {option: value}.
186186
187+
The dictionary configuration uses the same keys as the TOML 'database' definition given with --conf.
188+
187189
thread_count determines the max number of worker threads per database,
188190
if relevant. None means no limit.
189191
@@ -205,6 +207,12 @@ def connect(db_conf: Union[str, dict], thread_count: Optional[int] = 1) -> Datab
205207
- trino
206208
- clickhouse
207209
- vertica
210+
211+
Example:
212+
>>> connect("mysql://localhost/db")
213+
<data_diff.databases.mysql.MySQL object at 0x0000025DB45F4190>
214+
>>> connect({"driver": "mysql", "host": "localhost", "database": "db"})
215+
<data_diff.databases.mysql.MySQL object at 0x0000025DB3F94820>
208216
"""
209217
if isinstance(db_conf, str):
210218
return connect_to_uri(db_conf, thread_count)

0 commit comments

Comments
 (0)