Skip to content

Commit

Permalink
rename dataset accessor function
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Sep 30, 2024
1 parent d3d8381 commit f9a766d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dlt/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1717,7 +1717,7 @@ def __getstate__(self) -> Any:
# pickle only the SupportsPipeline protocol fields
return {"pipeline_name": self.pipeline_name}

def dataset(self, dataset_type: Literal["dbapi", "ibis"] = "dbapi") -> SupportsReadableDataset:
def _dataset(self, dataset_type: Literal["dbapi", "ibis"] = "dbapi") -> SupportsReadableDataset:
"""Access helper to dataset"""
if dataset_type == "dbapi":
return ReadableDBAPIDataset(self.sql_client(), schema=self.default_schema)
Expand Down
14 changes: 7 additions & 7 deletions tests/load/test_read_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def items():
pipeline.run(s, loader_file_format=destination_config.file_format)

# access via key
table_relationship = pipeline.dataset()["items"]
table_relationship = pipeline._dataset()["items"]

# full frame
df = table_relationship.df()
Expand All @@ -97,7 +97,7 @@ def items():
assert set(ids) == set(range(total_records))

# access via prop
table_relationship = pipeline.dataset().items
table_relationship = pipeline._dataset().items

#
# check arrow tables
Expand All @@ -121,7 +121,7 @@ def items():
assert set(ids) == set(range(total_records))

# check fetch accessors
table_relationship = pipeline.dataset().items
table_relationship = pipeline._dataset().items

# check accessing one item
one = table_relationship.fetchone()
Expand All @@ -144,7 +144,7 @@ def items():

# simple check that query also works
tname = pipeline.sql_client().make_qualified_table_name("items")
query_relationship = pipeline.dataset().query(f"select * from {tname} where id < 20")
query_relationship = pipeline._dataset().query(f"select * from {tname} where id < 20")

# we selected the first 20
table = query_relationship.arrow()
Expand Down Expand Up @@ -234,7 +234,7 @@ def items():

pipeline.run([items()], loader_file_format=destination_config.file_format)

df = pipeline.dataset().items.df()
df = pipeline._dataset().items.df()
assert len(df.index) == 20

@dlt.resource(table_name="items")
Expand All @@ -243,5 +243,5 @@ def items2():

pipeline.run([items2()], loader_file_format=destination_config.file_format)
# check df and arrow access
assert len(pipeline.dataset().items.df().index) == 50
assert pipeline.dataset().items.arrow().num_rows == 50
assert len(pipeline._dataset().items.df().index) == 50
assert pipeline._dataset().items.arrow().num_rows == 50

0 comments on commit f9a766d

Please sign in to comment.