awacke1 commited on
Commit
98c97fa
·
verified ·
1 Parent(s): 43fdc2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -176,7 +176,7 @@ def update_record(container, updated_record):
176
  # 🗑️ Delete record - Saying goodbye to data (it's not you, it's me)
177
  def delete_record(container, id):
178
  try:
179
- # First try to find the document using a query
180
  query = f"SELECT * FROM c WHERE c.id = @id"
181
  params = [{"name": "@id", "value": id}]
182
  items = list(container.query_items(
@@ -191,11 +191,10 @@ def delete_record(container, id):
191
  doc = items[0]
192
  partition_key = doc.get('id') # Using id as partition key
193
 
194
- # Delete with explicit partition key
195
  container.delete_item(
196
  item=id,
197
- partition_key=partition_key,
198
- enable_cross_partition_query=True
199
  )
200
 
201
  return True, f"Successfully deleted record with id: {id} 🗑️"
 
176
  # 🗑️ Delete record - Saying goodbye to data (it's not you, it's me)
177
  def delete_record(container, id):
178
  try:
179
+ # Query to find the document
180
  query = f"SELECT * FROM c WHERE c.id = @id"
181
  params = [{"name": "@id", "value": id}]
182
  items = list(container.query_items(
 
191
  doc = items[0]
192
  partition_key = doc.get('id') # Using id as partition key
193
 
194
+ # Delete with partition key
195
  container.delete_item(
196
  item=id,
197
+ partition_key=partition_key
 
198
  )
199
 
200
  return True, f"Successfully deleted record with id: {id} 🗑️"