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): add writer_properties to all operations #1980

Merged

Conversation

ion-elgreco
Copy link
Collaborator

Description

I've changed the API to consolidate that how we use writer properties. You now need to instantiate a WriterProperties class and then pass it to the writer, merge, delete, update, optimize operations.

wp = WriterProperties(compression='gzip', compression_level=1)
dt.optimize.z_order(['foo'], writer_properties=wp)

A potential idea I had is to allow users to set the write properties in the DeltaTable class once, so the properties can be grabbed from the tableclass so you don't have to provide them to each method.

@github-actions github-actions bot added the binding/python Issues for the Python package label Dec 17, 2023
@@ -575,7 +634,7 @@ def update(
Dict[str, Union[int, float, str, datetime, bool, List[Any]]]
] = None,
predicate: Optional[str] = None,
writer_properties: Optional[Dict[str, int]] = None,
writer_properties: Optional[WriterProperties] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

This, and similar changes in other places will break the compatibility, is that intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah it will be a breaking change here, so we need to mark that in the release

Copy link
Collaborator

@roeap roeap left a comment

Choose a reason for hiding this comment

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

Mor generally speaking, I have been contemplating if we should pull in pydantic as a dependency, to build a more powerful (and convenient) system to configure all of this.

Given the amount ot storage options, lock table, and a growing config of delta-rs itself it mays be helpful.

Then again, by now not so many users seem to complain about config etc ...

python/deltalake/_internal.pyi Show resolved Hide resolved
@ion-elgreco
Copy link
Collaborator Author

@roeap I am not sure if it's worth the effort, setting the storage options is quite clear since many other libraries share the same setup.

@ion-elgreco ion-elgreco enabled auto-merge (squash) December 19, 2023 20:49
@ion-elgreco ion-elgreco merged commit 9eef527 into delta-io:main Dec 19, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/python Issues for the Python package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants