Skip to content

Write Primitives merge_with_cte_source

Write Primitives benchmark · all Write Primitives queries

Representative SQL

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

WITH enriched_orders AS (
SELECT
o.o_orderkey,
o.o_totalprice,
c.c_name,
c.c_mktsegment
FROM orders AS o
JOIN customer AS c
ON o.o_custkey = c.c_custkey
WHERE
o.o_orderkey BETWEEN 1 AND 50
)
MERGE INTO merge_ops_summary_target AS target
USING enriched_orders AS source
ON target.o_orderkey = source.o_orderkey
WHEN MATCHED THEN UPDATE SET
o_totalprice = source.o_totalprice,
customer_name = source.c_name
WHEN NOT MATCHED THEN INSERT VALUES (source.o_orderkey, NULL, NULL, source.o_totalprice, source.c_name, NULL)

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_with_cte_source'])

Source

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