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

Commit 35af3e0

Browse files
authored
Merge pull request #157 from datafold/connect_with_dict
[api] Function connect_to_table() now accepts a dict (Issue #156)
2 parents 27e16aa + dcd58c0 commit 35af3e0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

data_diff/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Tuple, Iterator, Optional, Union
22

3-
from .databases.connect import connect_to_uri
3+
from .databases.connect import connect
44
from .diff_tables import (
55
TableSegment,
66
TableDiffer,
@@ -13,11 +13,18 @@
1313

1414

1515
def connect_to_table(
16-
db_uri: str, table_name: Union[DbPath, str], key_column: str = "id", thread_count: Optional[int] = 1, **kwargs
16+
db_info: Union[str, dict], table_name: Union[DbPath, str], key_column: str = "id", thread_count: Optional[int] = 1, **kwargs
1717
):
18-
"""Connects to a URI and creates a TableSegment instance"""
18+
"""Connects to the given database, and creates a TableSegment instance
1919
20-
db = connect_to_uri(db_uri, thread_count=thread_count)
20+
Parameters:
21+
db_info: Either a URI string, or a dict of connection options.
22+
table_name: Name of the table as a string, or a tuple that signifies the path.
23+
key_column: Name of the key column
24+
thread_count: Number of threads for this connection (only if using a threadpooled implementation)
25+
"""
26+
27+
db = connect(db_info, thread_count=thread_count)
2128

2229
if isinstance(table_name, str):
2330
table_name = db.parse_table_name(table_name)

0 commit comments

Comments
 (0)