Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Enable view arrow export in write_delta #20092

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions py-polars/polars/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4283,13 +4283,18 @@ def write_delta(
_check_if_delta_available()

from deltalake import DeltaTable, write_deltalake
from deltalake import __version__ as delta_version
from packaging.version import Version

_check_for_unsupported_types(self.dtypes)

if isinstance(target, (str, Path)):
target = _resolve_delta_lake_uri(str(target), strict=False)

data = self.to_arrow()
if Version(delta_version) >= Version("0.22.3"):
data = self.to_arrow(compat_level=CompatLevel.newest())
else:
data = self.to_arrow()

if mode == "merge":
if delta_merge_options is None:
Expand All @@ -4316,7 +4321,6 @@ def write_delta(
schema=schema,
mode=mode,
storage_options=storage_options,
large_dtypes=True,
Copy link
Member

Choose a reason for hiding this comment

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

If version <= 0.22.3 we should still pass large_dtypes=True, I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, since v0.19 that parameter doesn't do anything when the Rust engine is used for writing, which is the default. I'll change the minimum in pyproject.toml to >=0.19

**delta_write_options,
)
return None
Expand Down
Loading