Delete records

Delete records with primary keys:

status_code, response = db.delete(
  table_name="MyTable",        # The name of the table to delete records against.
  primary_keys=[1, 2, 5]       # The primary keys of the records to be deleted.
)
print(response)

Response example:

{'statusCode': 200, 'message': 'Delete data from MyTable successfully.', 'result': {'deleted': 3}}

Delete all records that satisfy a filter condition:

status_code, response = db.delete(
  table_name="MyTable",                 # The name of the table to delete records against.
  filter="ID < 6 AND Doc <> 'London'",  # (Optional) a boolean expression for specifying
                                        # which records to be deleted.
)
print(response)

Response example:

{'statusCode': 200, 'message': 'Delete data from MyTable successfully.', 'result': {'deleted': 14}}

Last updated