GPUdb C++ API  Version 5.2.0.0
gpudb::UpdateRecordsRequest< T > Struct Template Reference

A set of input parameters for updateRecordsRaw(const RawUpdateRecordsRequest&) const. More...

#include <gpudb/protocol/update_records.h>

Public Member Functions

 UpdateRecordsRequest ()
 Constructs an UpdateRecordsRequest object with default parameter values. More...
 
 UpdateRecordsRequest (const std::string &tableName, const std::vector< std::string > &expressions, const std::vector< std::map< std::string, std::string > > &newValuesMaps, const std::vector< T > &data, const std::map< std::string, std::string > &options)
 Constructs an UpdateRecordsRequest object with the specified parameters. More...
 

Public Attributes

std::string tableName
 
std::vector< std::string > expressions
 
std::vector< std::map< std::string, std::string > > newValuesMaps
 
std::vector< T > data
 
std::map< std::string, std::string > options
 

Detailed Description

template<typename T>
struct gpudb::UpdateRecordsRequest< T >

A set of input parameters for updateRecordsRaw(const RawUpdateRecordsRequest&) const.

Runs multiple predicate-based updates in a single call. With the list of given expressions, any matching record's column values will be updated as provided in newValuesMaps. There is also an optional 'upsert' capability where if a particular predicate doesn't match any existing record, then a new record can be inserted.

Note that this operation can only be run on an original table and not on a collection or a result view.

This operation can update primary key values. By default only 'pure primary key' predicates are allowed when updating primary key values. If the primary key for a table is the column 'attr1', then the operation will only accept predicates of the form: "attr1 == 'foo'" if the attr1 column is being updated. For a composite primary key (e.g. columns 'attr1' and 'attr2') then this operation will only accept predicates of the form: "(attr1 == 'foo') and (attr2 == 'bar')". Meaning, all primary key columns must appear in an equality predicate in the expressions. Furthermore each 'pure primary key' predicate must be unique within a given request. These restrictions can be removed by utilizing some available options through options.

Parameters
<T>The type of object being processed.

Definition at line 302 of file update_records.h.

Constructor & Destructor Documentation

template<typename T >
gpudb::UpdateRecordsRequest< T >::UpdateRecordsRequest ( )
inline

Constructs an UpdateRecordsRequest object with default parameter values.

Definition at line 309 of file update_records.h.

template<typename T >
gpudb::UpdateRecordsRequest< T >::UpdateRecordsRequest ( const std::string &  tableName,
const std::vector< std::string > &  expressions,
const std::vector< std::map< std::string, std::string > > &  newValuesMaps,
const std::vector< T > &  data,
const std::map< std::string, std::string > &  options 
)
inline

Constructs an UpdateRecordsRequest object with the specified parameters.

Parameters
[in]tableNameTable to be updated. Must be a currently existing table and not a collection or view.
[in]expressionsA list of the actual predicates, one for each update; format should follow the guidelines /filter.
[in]newValuesMapsList of new values for the matching records. Each element is a map with (key, value) pairs where the keys are the names of the columns whose values are to be updated; the values are the new values. The number of elements in the list should match the length of expressions.
[in]dataAn optional list of new binary-avro encoded records to insert, one for each update. If one of expressions does not yield a matching record to be updated, then the corresponding element from this list will be added to the table. Default value is an empty std::vector.
[in]optionsOptional parameters.
  • global_expression: An optional global expression to reduce the search space of the predicates listed in expressions.
  • bypass_safety_checks: When set to 'true', all predicates are available for primary key updates. Keep in mind that it is possible to destroy data in this case, since a single predicate may match multiple objects (potentially all of records of a table), and then updating all of those records to have the same primary key will, due to the primary key uniqueness constraints, effectively delete all but one of those updated records. Values: 'true', 'false'.
  • update_on_existing_pk: Can be used to customize behavior when the updated primary key value already exists, as described in /insert/records. Values: 'true', 'false'.
  • record_id: ID of a single record to be updated (returned in the call to /insert/records or /get/records/fromcollection).
Default value is an empty std::map.

Definition at line 367 of file update_records.h.

Member Data Documentation

template<typename T >
std::vector<T> gpudb::UpdateRecordsRequest< T >::data

Definition at line 379 of file update_records.h.

template<typename T >
std::vector<std::string> gpudb::UpdateRecordsRequest< T >::expressions

Definition at line 377 of file update_records.h.

template<typename T >
std::vector<std::map<std::string, std::string> > gpudb::UpdateRecordsRequest< T >::newValuesMaps

Definition at line 378 of file update_records.h.

template<typename T >
std::map<std::string, std::string> gpudb::UpdateRecordsRequest< T >::options

Definition at line 380 of file update_records.h.

template<typename T >
std::string gpudb::UpdateRecordsRequest< T >::tableName

Definition at line 376 of file update_records.h.


The documentation for this struct was generated from the following file: