Skip to main content
filter_by_list(table_name=None, view_name=, column_values_map=None, options=)[source]

Calculates which records from a table have values in the given list for the corresponding column. The operation is synchronous, meaning that a response will not be returned until all the objects are fully available. The response payload provides the count of the resulting set. A new resultant set (view) which satisfies the input filter specification is also created if a input parameter view_name is passed in as part of the request.

For example, if a type definition has the columns ‘x’ and ‘y’, then a filter by list query with the column map “x”:[“10.1”, “2.3”], “y”:[“0.0”, “-31.5”, “42.0”] will return the count of all data points whose x and y values match both in the respective x- and y-lists, e.g., “x = 10.1 and y = 0.0”, “x = 2.3 and y = -31.5”, etc. However, a record with “x = 10.1 and y = -31.5” or “x = 2.3 and y = 0.0” would not be returned because the values in the given lists do not correspond.

Parameters

table_name (str) –

Name of the table to filter, in [schema_name.]table_name format, using standard name resolution rules. This may be the name of a table or a view (when chaining queries).

view_name (str) –

If provided, then this will be the name of the view containing the results, in [schema_name.]view_name format, using standard name resolution rules and meeting table naming criteria. Must not be an already existing table or view. The default value is ‘’.

column_values_map (dict of str to lists of str) –

List of values for the corresponding column in the table.

options (dict of str to str) –

Optional parameters. Allowed keys are:

  • create_temp_table – If true, a unique temporary table name will be generated in the sys_temp schema and used in place of input parameter view_name. This is always allowed even if the caller does not have permission to create tables. The generated name is returned in qualified_view_name. Allowed values are:

    • true

    • false

    The default value is ‘false’.

  • collection_name – [DEPRECATED–please specify the containing schema for the view as part of input parameter view_name and use GPUdb.create_schema() to create the schema if non-existent] Name of a schema for the newly created view. If the schema provided is non-existent, it will be automatically created.

  • filter_mode – String indicating the filter mode, either ‘in_list’ or ‘not_in_list’. Allowed values are:

    • in_list – The filter will match all items that are in the provided list(s).

    • not_in_list – The filter will match all items that are not in the provided list(s).

    The default value is ‘in_list’.

The default value is an empty dict ( ).

Returns

A dict with the following entries–

count (long) –

The number of records passing the list filter.

info (dict of str to str) –

Additional information. Allowed keys are:

  • qualified_view_name – The fully qualified name of the view (i.e. including the schema).

The default value is an empty dict ( ).