Skip to content

Commit e77531a

Browse files
tpellissierclaude
andcommitted
Add UpsertMultiple diagnostic step to example
UpsertMultiple returns 400 Bad Request on custom tables while single PATCH upsert works correctly. This is a pre-existing issue in the _upsert_multiple implementation (PR #106) that needs investigation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 756a005 commit e77531a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

examples/advanced/alternate_keys_upsert.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,30 @@ def main():
158158
)
159159
print(" Upserted EXT-002 (single)")
160160

161+
print("\n4c. Upsert multiple records (UpsertMultiple bulk)...")
162+
try:
163+
client.records.upsert(
164+
TABLE_NAME,
165+
[
166+
UpsertItem(
167+
alternate_key={KEY_COLUMN.lower(): "EXT-003"},
168+
record={"new_productname": "Widget C", "new_price": 29.99},
169+
),
170+
UpsertItem(
171+
alternate_key={KEY_COLUMN.lower(): "EXT-004"},
172+
record={"new_productname": "Widget D", "new_price": 39.99},
173+
),
174+
],
175+
)
176+
print(" Upserted EXT-003, EXT-004 (bulk)")
177+
except Exception as ex: # noqa: BLE001
178+
print(f" UpsertMultiple FAILED: {ex}")
179+
if hasattr(ex, "status_code"):
180+
print(f" Status: {ex.status_code}")
181+
if hasattr(ex, "service_error_code"):
182+
print(f" Service error code: {ex.service_error_code}")
183+
print(" (single upsert worked, bulk did not - known issue under investigation)")
184+
161185
# ------------------------------------------------------------------
162186
# Step 5: Upsert again (updates existing via single PATCH)
163187
# ------------------------------------------------------------------

0 commit comments

Comments
 (0)