Skip to main content
get_records_from_collection_and_decode(table_name=None, offset=0, limit=-9999, encoding=‘binary’, options=, force_primitive_return_types=True)[source]

Retrieves records from a collection. The operation can optionally return the record IDs which can be used in certain queries such as GPUdb.delete_records().

This operation supports paging through the data via the input parameter offset and input parameter limit parameters.

Note that when using the Java API, it is not possible to retrieve records from join views using this operation. (DEPRECATED)

Parameters

table_name (str) –

Name of the collection or table from which records are to be retrieved, in [schema_name.]table_name format, using standard name resolution rules. Must be an existing collection or table.

offset (long) –

A positive integer indicating the number of initial results to skip (this can be useful for paging through the results). The default value is 0. The minimum allowed value is 0. The maximum allowed value is MAX_INT.

limit (long) –

A positive integer indicating the maximum number of results to be returned, or END_OF_SET (-9999) to indicate that the maximum number of results allowed by the server should be returned. The number of records returned will never exceed the server’s own limit, defined by the max_get_records_size parameter in the server configuration. Use input parameter offset and input parameter limit to request subsequent pages of results. The default value is -9999.

encoding (str) –

Specifies the encoding for returned records; either binary or json. Allowed values are:

  • binary

  • json

The default value is ‘binary’.

options (dict of str to str) –

Allowed keys are:

  • return_record_ids – If true then return the internal record ID along with each returned record. Allowed values are:

    • true

    • false

    The default value is ‘false’.

  • expression – Filter expression to apply to the table. The default value is ‘’.

The default value is an empty dict ( ).

force_primitive_return_types (bool) –

If True, then OrderedDict objects will be returned, where string sub-type columns will have their values converted back to strings; for example, the Python datetime structs, used for datetime type columns would have their values returned as strings. If False, then Record objects will be returned, which for string sub-types, will return native or custom structs; no conversion to string takes place. String conversions, when returning OrderedDicts, incur a speed penalty, and it is strongly recommended to use the Record object option instead. If True, but none of the returned columns require a conversion, then the original Record objects will be returned. Default value is True.

Returns

A dict with the following entries–

table_name (str) –

Value of input parameter table_name.

type_names (list of str) –

The type IDs of the corresponding records in output parameter records_binary or output parameter records_json. This is useful when input parameter table_name is a heterogeneous collection (collections containing tables of different types).

record_ids (list of str) –

If the ‘return_record_ids’ option of the request was ‘true’, then this list contains the internal ID for each object. Otherwise it will be empty.

info (dict of str to str) –

Additional information. Allowed keys are:

  • total_number_of_records – Total number of records.

  • has_more_records – Too many records. Returned a partial set. Allowed values are:

    • true

    • false

The default value is an empty dict ( ).

records (list of Record) –

A list of Record objects which contain the decoded records.