| RECORD_METADATA | ID | FIRST_NAME | LAST_NAME | _STREAMKAP_SOURCE_TS_MS | _STREAMKAP_TS_MS | __DELETED | _STREAMKAP_OFFSET |
|---|---|---|---|---|---|---|---|
| 1302 | Paul | Smith | 1727770177000 | 1727770177618 | FALSE | 309707 |
ID: also the source table’s primary key.FIRST_NAMELAST_NAME
RECORD_METADATA: Metadata such as the origin topic, partition, offset, event type and more. It can be useful for debugging purposes._STREAMKAP_SOURCE_TS_MS: Timestamp in milliseconds (UTC) for when the event occurred in the source database._STREAMKAP_TS_MS: Timestamp in milliseconds (UTC) for when Streamkap received the event.__DELETED: Indicates whether this event/row (by its primary key) has been deleted in the source database._STREAMKAP_OFFSET: This is an offset value in relation to the events we process. It can be useful for debugging purposes.
Why
_STREAMKAP_OFFSET must be in the ORDER BY clauseIncluding _STREAMKAP_OFFSET in the ORDER BY is mandatory for correct deduplication. Multiple events for the same primary key can have the same _STREAMKAP_TS_MS timestamp (e.g., rapid successive updates within the same millisecond). Without _STREAMKAP_OFFSET, records with the same timestamp but different offsets may be deduplicated incorrectly, potentially selecting an older event over the latest one.Snowflake
Task & Merge Statement
SQL
Dynamic Tables
Streamkap supports the auto creation and maintenance of Snowflake Dynamic Tables for this final view but the logic underneath is as followsSQL
DBT
SQL Example
SQL
{{ this }} declaration for DBT, since it can use post DBT hook to delete the __deleted columns that are true.
Python Example
This is an example approach for generating the DBT incremental models.Python