Skip to content

Commit 30a0626

Browse files
tpellissierclaude
andcommitted
Split example into single + bulk upsert steps for clearer diagnostics
Separates single PATCH upsert (step 4a) from UpsertMultiple bulk (step 4b) to make it clear which path is being exercised. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cec9f3f commit 30a0626

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

examples/advanced/alternate_keys_upsert.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,26 +134,38 @@ def main():
134134
# ------------------------------------------------------------------
135135
# Step 4: Upsert records (creates new)
136136
# ------------------------------------------------------------------
137-
print("\n4. Upserting records (initial create)...")
137+
print("\n4a. Upsert single record (PATCH, creates new)...")
138138
client.records.upsert(
139139
TABLE_NAME,
140140
[
141141
UpsertItem(
142142
alternate_key={KEY_COLUMN.lower(): "EXT-001"},
143143
record={"new_productname": "Widget A", "new_price": 9.99},
144144
),
145+
],
146+
)
147+
print(" Upserted EXT-001 (single)")
148+
149+
print("\n4b. Upsert multiple records (UpsertMultiple bulk, creates new)...")
150+
client.records.upsert(
151+
TABLE_NAME,
152+
[
145153
UpsertItem(
146154
alternate_key={KEY_COLUMN.lower(): "EXT-002"},
147155
record={"new_productname": "Widget B", "new_price": 19.99},
148156
),
157+
UpsertItem(
158+
alternate_key={KEY_COLUMN.lower(): "EXT-003"},
159+
record={"new_productname": "Widget C", "new_price": 29.99},
160+
),
149161
],
150162
)
151-
print(" Upserted 2 records")
163+
print(" Upserted EXT-002, EXT-003 (bulk)")
152164

153165
# ------------------------------------------------------------------
154-
# Step 5: Upsert again (updates existing)
166+
# Step 5: Upsert again (updates existing via single PATCH)
155167
# ------------------------------------------------------------------
156-
print("\n5. Upserting records (update existing)...")
168+
print("\n5. Upserting record (update existing via PATCH)...")
157169
client.records.upsert(
158170
TABLE_NAME,
159171
[

0 commit comments

Comments
 (0)