From f9a766d02bb0f8e67f4ee18d0afa89f30d5f5b4c Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 30 Sep 2024 13:07:18 +0200 Subject: [PATCH] rename dataset accessor function --- dlt/pipeline/pipeline.py | 2 +- tests/load/test_read_interfaces.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlt/pipeline/pipeline.py b/dlt/pipeline/pipeline.py index bddd928876..95ffbe3e56 100644 --- a/dlt/pipeline/pipeline.py +++ b/dlt/pipeline/pipeline.py @@ -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) diff --git a/tests/load/test_read_interfaces.py b/tests/load/test_read_interfaces.py index c9ff3070ba..1018991904 100644 --- a/tests/load/test_read_interfaces.py +++ b/tests/load/test_read_interfaces.py @@ -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() @@ -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 @@ -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() @@ -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() @@ -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") @@ -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