Skip to main content
delete_records(table_name=None, expressions=None, options=)[source]

Deletes record(s) matching the provided criteria from the given table. The record selection criteria can either be one or more input parameter expressions (matching multiple records), a single record identified by record_id options, or all records when using delete_all_records. Note that the three selection criteria are mutually exclusive. This operation cannot be run on a view. The operation is synchronous meaning that a response will not be available until the request is completely processed and all the matching records are deleted.

Parameters

table_name (str) –

Name of the table from which to delete records, in [schema_name.]table_name format, using standard name resolution rules. Must contain the name of an existing table; not applicable to views.

expressions (list of str) –

A list of the actual predicates, one for each select; format should follow the guidelines provided here. Specifying one or more input parameter expressions is mutually exclusive to specifying record_id in the input parameter options. The user can provide a single element (which will be automatically promoted to a list internally) or a list.

options (dict of str to str) –

Optional parameters. Allowed keys are:

  • global_expression – An optional global expression to reduce the search space of the input parameter expressions. The default value is ‘’.

  • record_id – A record ID identifying a single record, obtained at the time of insertion of the record or by calling GPUdb.get_records_from_collection() with the return_record_ids option. This option cannot be used to delete records from replicated tables.

  • delete_all_records – If set to true, all records in the table will be deleted. If set to false, then the option is effectively ignored. Allowed values are:

    • true

    • false

    The default value is ‘false’.

The default value is an empty dict ( ).

Returns

A dict with the following entries–

count_deleted (long) –

Total number of records deleted across all expressions.

counts_deleted (list of longs) –

Total number of records deleted per expression.

info (dict of str to str) –

Additional information.