diff --git a/cfa/dataops/catalog.py b/cfa/dataops/catalog.py index 3258cff..279752a 100644 --- a/cfa/dataops/catalog.py +++ b/cfa/dataops/catalog.py @@ -220,17 +220,20 @@ def write_blob( self.ledger_entry(action="write") # print(f"file written to: {full_path}") - def read_blobs(self, version: str = "latest", newest: bool = True) -> list[bytes]: + def read_blobs( + self, version: str = "latest", newest: bool = True, print_version: bool = True + ) -> list[bytes]: """Read a blob in as bytes so it can be loaded into a dataframe Args: - path_after_prefix (str): The path to the data (e.g., - {timestamp}/dataset.csv) version (str, optional): the version of the data to read. Defaults to "latest". newest (bool, optional): whether to get the newest matching version. Defaults to True. + print_version (bool, optional): whether to print the version being used. Defaults to True. """ - blobs = self._get_version_blobs(version, newest=newest) + blobs = self._get_version_blobs( + version, newest=newest, print_version=print_version + ) blob_bytes = [ read_blob_stream( blob_url=i["name"], @@ -473,8 +476,11 @@ def get_dataframe( return df else: raise ValueError(f"Lazy loading not supported for {file_ext} files.") - blobs = self.read_blobs(version, newest=newest) - blob_bytes = [blob.content_as_bytes() for blob in blobs] + blobs = self.read_blobs(version, newest=newest, print_version=False) + blob_bytes = [ + blob if isinstance(blob, bytes) else blob.content_as_bytes() + for blob in blobs + ] blob_files = [BytesIO(pq) for pq in blob_bytes] if file_ext == "csv": if output in ["pandas", "pd"]: diff --git a/changelog.md b/changelog.md index db9f51e..2445091 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,12 @@ and this project adheres to [Calendar Versioning](https://calver.org/). The versioning pattern is `YYYY.MM.DD.micro(a/b/{none if release}) --- +## [2026.04.27.0] + +### Fixed + +- In some get_dataframe() calls, the version would be printed twice. This has been fixed. + ## [2026.04.24.0] ### Updated diff --git a/pyproject.toml b/pyproject.toml index 331c8f4..afb80c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cfa.dataops" -version = "2026.04.24.0" +version = "2026.04.27.0" description = "Data cataloging, ETL, modeling, verification, and validation for CFA" authors = [ { name = "Phil Rogers", email = "ap66@cdc.gov" },