Skip to content

Write Primitives merge_scd_type2_new_keys_only

Write Primitives benchmark · all Write Primitives queries

Representative SQL

Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).

INSERT INTO scd2_ops_dim_customer
SELECT
(
SELECT
MAX(sk)
FROM scd2_ops_dim_customer
) + ROW_NUMBER() OVER (ORDER BY s.c_custkey),
s.c_custkey,
s.c_name,
s.c_address,
s.c_acctbal,
s.c_mktsegment,
s.row_hash,
TRUE,
s.effective_ts,
CAST('9999-12-31' AS DATE)
FROM scd2_ops_stage_customer AS s
WHERE
s.change_type = 'new'
AND NOT EXISTS(
SELECT
1
FROM scd2_ops_dim_customer AS d
WHERE
d.c_custkey = s.c_custkey
)

Representative DataFrame

No DataFrame implementation is registered for this query.

Get the exact query for your run

The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:

from benchbox import WritePrimitives
bench = WritePrimitives(scale_factor=0.01) # your scale factor
print(bench.get_queries()['merge_scd_type2_new_keys_only'])

Source

Query text: benchbox/core/write_primitives/operations.py