Skip to content

Rr 61 polarslazyframe#65

Merged
ryanraaschCDC merged 18 commits into
mainfrom
rr-61-polarslazyframe
Mar 31, 2026
Merged

Rr 61 polarslazyframe#65
ryanraaschCDC merged 18 commits into
mainfrom
rr-61-polarslazyframe

Conversation

@ryanraaschCDC

Copy link
Copy Markdown
Collaborator

No description provided.

@ryanraaschCDC
ryanraaschCDC requested a review from Copilot March 19, 2026 16:24
@ryanraaschCDC ryanraaschCDC linked an issue Mar 19, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Polars LazyFrame support to BlobEndpoint.get_dataframe() to enable lazy loading (via scan_*) for certain Azure-hosted datasets.

Changes:

  • Introduces a pl_lazy fast-path that uses pl.scan_parquet / pl.scan_csv against az:// URIs.
  • Adds Azure managed-identity credential wiring for Polars cloud reads.
  • Removes eager-to-lazy conversion for CSV in the eager path (now handled by the scan_csv early return).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py
ryanraaschCDC and others added 3 commits March 19, 2026 09:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ryanraaschCDC
ryanraaschCDC requested a review from Copilot March 19, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the data catalog’s BlobEndpoint.get_dataframe() to support returning a Polars LazyFrame for certain file types by using Polars’ lazy scanning against Azure Blob Storage.

Changes:

  • Expands get_dataframe() return type to include pl.LazyFrame.
  • Adds a pl_lazy fast-path that uses pl.scan_parquet / pl.scan_csv with Azure credential plumbing.
  • Removes the previous df.lazy() conversion for the eager CSV Polars path (since CSV lazy now uses scanning).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py
ryanraaschCDC and others added 4 commits March 19, 2026 09:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py
)
self.ledger_entry(action="read")
return df
elif file_ext == "csv":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a strong opportunity to generalize all of the polars reading code into something with a variable reading function. Ie you can pass pl.read_csv or pl.scan_csv as an argument to more general function.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates BlobEndpoint.get_dataframe() to support returning a Polars LazyFrame backed by Azure Blob Storage scanning, while also tightening typing via Literal overloads and expanding supported output aliases.

Changes:

  • Add output="pl_lazy" / "lazy" mode that uses pl.scan_* against az:// URIs for parquet/csv/ndjson.
  • Replace the old pl_lazy: bool flag with typed output variants and overloads for better return-type inference.
  • Extend JSON-lines handling to treat ndjson and jsonl equivalently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py Outdated
Comment thread cfa/dataops/catalog.py
ryanraaschCDC and others added 4 commits March 25, 2026 15:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ryanraaschCDC

Copy link
Copy Markdown
Collaborator Author

@damonbayer please re-review. I made all your updates except for generalizing all the polars reading code. Let me know if that's something you need implemented and I can get that added.

Comment thread tests/test_datasets_catalog.py

@damonbayer damonbayer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hints are not working correctly, but it's not due to anything in this PR. Will open a separate issue. Thanks @ryanraaschCDC!

@ryanraaschCDC
ryanraaschCDC merged commit fd81ce7 into main Mar 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support loading datasets as polars.LazyFrame

4 participants