Repository navigation
Updated streaming docs. - #179
Conversation
|
|
||
| ``` | ||
| ### Deduplication of Row Per-Microbatch | ||
| The written dataframe cannot contain two rows with the same primary key. The SDK includes a default two-step deduplication pass that first picks the row with |
There was a problem hiding this comment.
Nit: we went back and forth on this, but in a way this is not a default impl in that users must provide dedup_order and provide its values themselves. Might be better to say a "standard" option (and the rest of the sentence is perfect).
| | _commit_version | long | per-source DLO | | ||
| | _commit_timestamp | timestamp | when the commit landed in the source DLO, not exact | | ||
| | _source_table_name | string | the source DLO for the row | | ||
| | _source_record_key | string, opaque | The source DLO's PK value for this row | |
There was a problem hiding this comment.
The PK aspect of this is kind of an impl detail we don't want customers thinking about (because it could change in the future). For the Notes column, what about something like: "An opaque string that identifies a source row. It is specific to each source DLO: two DLOs never share a value, even if their primary keys and row contents are identical. Rows with the same _source_record_key are versions of one source row. This can be a helpful partition for deduplication, for example to order by _commit_version."
| The DataFrame you write must have: | ||
|
|
||
| * _merge_record_type: UPSERT or DELETE. | ||
| * _commit_version, _source_table_name and _source_record_key, as read. The sink uses them to find the latest version of each source record. |
There was a problem hiding this comment.
I think this is out of date and we can remove it altogether. _merge_record_type is the only required "system" / non-written column. All others are only required if they are used in dedup_order.
| * _commit_version, _source_table_name and _source_record_key, as read. The sink uses them to find the latest version of each source record. | ||
| * The target DLO's PK columns. | ||
|
|
||
| The stream fails at start if any of these is missing. Columns that aren't in the target DLO, including every system column, aren't written. |
There was a problem hiding this comment.
Can we also note that _change_type must be dropped? I'm creating a WI to re-consider how forcefully it's rejected - right now if you send _change_type into the write_dlo_deltas it will fail very early in the process. But for now, it's important to know it must be dropped from the dataframe.
| ### Deduplication of Row Per-Microbatch | ||
| The written dataframe cannot contain two rows with the same primary key. The SDK includes a default two-step deduplication pass that first picks the row with | ||
| the latest commit version and then picks upserts over deletes. Depending on the shape of your data, this may not be enough to pick a single row. Full control | ||
| of the deduplication is available by setting the dedup_order parameters in write_*_deltas methods. The parameter is an ordered list of entries `{"column", "direction", "partition"}`. Each entry narrows, within its partition, to the rows tied on its column. `partition` is optional and names any column in your DataFrame; an entry without it runs per target primary key. Entries with `partition` must come before entries without it. If more than one row is left for a key after the last entry, the batch fails. |
There was a problem hiding this comment.
Nit: full control isn't only available, it's actually required. dedup_order is required, and the values in it are completely up to the customer.
| ### Deduplication of Row Per-Microbatch | ||
| The written dataframe cannot contain two rows with the same primary key. The SDK includes a default two-step deduplication pass that first picks the row with | ||
| the latest commit version and then picks upserts over deletes. Depending on the shape of your data, this may not be enough to pick a single row. Full control | ||
| of the deduplication is available by setting the dedup_order parameters in write_*_deltas methods. The parameter is an ordered list of entries `{"column", "direction", "partition"}`. Each entry narrows, within its partition, to the rows tied on its column. `partition` is optional and names any column in your DataFrame; an entry without it runs per target primary key. Entries with `partition` must come before entries without it. If more than one row is left for a key after the last entry, the batch fails. |
There was a problem hiding this comment.
Do we want to go into the details of what a DedupConflictException look like, and how to understand it?
No description provided.