feat: native append/replace/upsert load modes#38
Draft
shefeek-jinnah wants to merge 1 commit into
Draft
Conversation
Push loads down as the server's native load modes instead of a client-side read-modify-write: - append / replace upload the batch directly (no full-table read+rewrite) - merge -> native upsert by the table's declared key (updates matches, inserts the rest); the key is declared up front via the SDK's new create_managed_database(keys=) / add_managed_table(key=) - insert-only, and a merge without a resolvable primary key, still combine client-side and replace Also fixes two long-standing bugs in the combine path: - resolve_primary_key now reads dlt's per-column primary_key hints (it read a top-level table key dlt never sets, so merge deduped by the row-unique _dlt_id -> duplicates across runs) - normalise Arrow string_view/large reads to plain string/binary before combining (ArrowTypeError: string_view vs string) Needs the SDK's mode/key support and the key-capable hotdata client; dependency floors bumped (exact tags TBD at release).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚧 Draft — depends on the SDK's
mode/key support (hotdata-framework, separate PR) and a regeneratedhotdataclient whose managed-table decls carrykey. Dependency floors are bumped withTODO(release)markers; un-draft once those are released and the exact pins are set.What
Push loads down as the server's native load modes instead of a client-side read-modify-write.
append/replaceupload the batch directly — no full-table read + rewrite.merge→ nativeupsertby the resource'sprimary_key(updates matches, inserts the rest); the table's key is declared up front (initialize_storage+ reconcile-add).insert-only, and amergewith no resolvable primary key, still combine client-side and replace (the_dlt_idfallback can't match a logical row across runs).Also fixes two combine-path bugs
resolve_primary_keynow reads dlt's per-columnprimary_keyhints — it read a top-level table key dlt never sets, somergesilently deduped by the row-unique_dlt_idand produced duplicates across runs instead of updating in place.string_view/large reads are normalized to plainstring/binarybefore combining (fixesArrowTypeError: string_view vs string).Testing
test_merge_dedupvalidates the native upsert path.Before un-drafting
hotdata,hotdata-framework).ruff+mypy.