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

Accept strings for the mode when finalizing staged data #2232

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ognyanstoimenov
Copy link
Collaborator

Reference Issues/PRs

What does this implement or fix?

Monday ref 8645841959
Support strings for finalize staged data mode argument in addition to enum

Any other comments?

Checklist

Checklist for code changes...
  • Have you updated the relevant docstrings, documentation and copyright notice?
  • Is this contribution tested against all ArcticDB's features?
  • Do all exceptions introduced raise appropriate error messages?
  • Are API changes highlighted in the PR description?
  • Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?

@ognyanstoimenov ognyanstoimenov added the patch Small change, should increase patch version label Mar 12, 2025
{"write", None},
],
)
def test_finalize_staged_data(arctic_library_lmdb, input_mode, expected_append):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a good unit test but I think we should also have some integration tests that check we are actually doing the right thing.

The expected_append==None case should probably be split to its own test, rather than parameters in this one.

mode : `StagedDataFinalizeMethod`, default=StagedDataFinalizeMethod.WRITE
Finalize mode. Valid options are WRITE or APPEND. Write collects the staged data and writes them to a
new version. Append collects the staged data and appends them to the latest version.
mode : Union[`StagedDataFinalizeMethod`, str], default=StagedDataFinalizeMethod.WRITE
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think lowercase write, append will match both Pandas and our QueryBuilder APIs better.

@@ -1383,9 +1383,12 @@ def finalize_staged_data(
2024-01-03 3
2024-01-04 4
"""
if not (mode is None or isinstance(mode, StagedDataFinalizeMethod) or mode == "WRITE" or mode == "APPEND"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should validate against mode==None shouldn't you, what does it mean?

@@ -1383,9 +1383,12 @@ def finalize_staged_data(
2024-01-03 3
2024-01-04 4
"""
if not (mode is None or isinstance(mode, StagedDataFinalizeMethod) or mode == "WRITE" or mode == "APPEND"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

if not isinstance(mode, StagedDataFinalizeMethod) or mode not in ("write", "append") is clearer to me, as it's closer to English

@@ -1383,9 +1383,12 @@ def finalize_staged_data(
2024-01-03 3
2024-01-04 4
"""
if not (mode is None or isinstance(mode, StagedDataFinalizeMethod) or mode == "WRITE" or mode == "APPEND"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should validate that the enum value is either WRITE or APPEND as protection against someone changing the enum and us silently treating it as WRITE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Small change, should increase patch version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants